1 - it will use 5 as you've specifically set that, anything you don't specify will just use the cluster default. 2 - The data isn't replicated into all the shards, it splits the complete data up into 5 shards. Then each replica set will contain a copy of the data, which is then also sharded. 3 - ES will distribute data across all shards as best it can. It will also not store the replicas for a shard on the same node as the primary. So if a node that holds a primary shard dies, thena secondary shard will be promoted to primary.
Regards, Mark Walkom Infrastructure Engineer Campaign Monitor email: [email protected] web: www.campaignmonitor.com On 1 April 2014 06:49, Subhadip Bagui <[email protected]> wrote: > Hi, > > I've started working on elasticsearch and having some doubts about shards > and replicas and how they handle data. I don't have any prior knowledge on > Lucene. > As I know lucene will split data in segments and store in disk, and shard > is the lucene index itself. Some of the doubts which I have is... > > 1) There are two way we can do shard allocation, one in cluster level with > config settings and another in index level settings. Suppose in cluster > level I mentioned max shard is 3 and in index level I mentioned 5 shards, > how the shards will be allocated? I have one cluster one node. > > 2) Suppose, one index is having 5 shards and 2 replicas and I'm pushing > data in bulk api, how the data will be stored? Is same data will be stored > in 5 shards or the data will split and store in chunks in 5 shards? How > replicas will have backup of data of all 5 shards? > > 3) Suppose I have 5 nodes and 10 shards are distributed over the nodes, 2 > shards each. So when I index new documents how the data will be stored in > over the nodes? > Suppose the 5th node goes down suddenly which is holding 9th and 10th > shard. Now do I loose all the data stored in 9th and 10th shard or the data > are already copied in rest of the nodes ? > > Please explain. > > Thanks, > Subhadip > > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/4ac575bd-0d0a-4f5f-972e-7f3c54f2eb85%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/4ac575bd-0d0a-4f5f-972e-7f3c54f2eb85%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAEM624anWNJjEnTDQuUqaZ2Wy8mmagth3Occ71QQMR_WO0obtQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
