How Shards and Replicas distributed on the cluster


(vijayakrishna Gade) #1

Hi,

I have provisioned Elastic Cluster with 1 node and index has been divided into 5 shards, Later i have added another node into the cluster and it's by default shows 5 shards on new node, how this Shards mechanism works?

initially when we have 1 node it shows 5 shards then after adding another node its also shows 5 shards, it means total 10 shards? or or both nodes shows 5 shards each it means duplicate shards maintain on another node? it supposed shared among both nodes it mean node1 can have 3 and another node can have 2 shards, is that how it should work,?

it will be really helpful if someone can provide bit more in detail, thanks.


(Tek Chand) #2

@vijayakrishna.rg, When you created your index that have 5 shards and 1 replica. Its means there will be total 10 shards 5 primary shards and 5 replica shards one for each primary shards. When you have only one node in your cluster your cluster health should be yellow. Because you don't have second node to assign replica shards. When you added 2nd node into your cluster the master node will distribute the primary shards and replica shards between 2 nodes. Each node may contain primary shards as well as replica shards.

Let say, Your have 5 primary shards P1, P2, P3...P5 and one replica shard for each primary shards i.e R1, R2....R5.

Now you have 2 data node in your cluster and 1st data node may have P1,P2,R3,R4,R5 and 2nd data node may have P3,P4,P5,R1,R2. Its fully managed by elasticsearch master node.

Hope so above line will help you. Kindly let me know if you have any question.

Thanks.


(vijayakrishna Gade) #3

@Tek_Chand Thanks for Explanation.


(system) #4

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