Single Shard 0 replicas 3 nodes

Hi,

I am trying to understand the shards and replicas in elasticsearch. I have 3 nodes in my elastic cluster. My indices are created with 1 shard and 0 replicas. I assume in this scenario each of my node would have 1 copy of the index ? if I create 3 shards and 2 replicas per index, I understand each node will have 1 primary shard and 2 replica shards of the other nodes which I believe is same as the first scenario where I have single shard with no replicas (in both the scenarios each node will have complete index) . Am I right in my assumption ? if yes, which approach is better for a cluster with 3 nodes ? single shard with 0 replicas or 3 shards with 2 replicas ?

The number_of_shards defines the number of primary shards and the number_of_replicas is a replication factor of the primary shards.

The formula to define the total count of shards of number_of_shards * (1 + number_of_replicas)

So, in your example, if you define 1 shard and 0 replicas, then you will have 1 shard only for this index, and not 3, regardless of how many nodes your cluster have.

If you define 3 shards and 2 replicas, then this index will have 9 shards in which 3 are primaries and the other 6 are replicas.

There is a diagram here https://www.elastic.co/guide/en/elasticsearch/guide/current/replica-shards.html that explains this better.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.