Distribute primary shards among newly added data nodes

I am looking for a way to automatically distribute Elasticsearch's primary shards among the newly added data nodes.

I know a way to achieve this is by re-indexing after the new nodes are added. Is there any internal configuration or other simpler way by which it can be done automatically once the cluster configurations are altered?

Example Scenario

Initially, the cluster has 3 data nodes and an index with 6 primary shards and 5 replicas. So Elasticsearch distributes 2 primary shards among each node. I increased the number of data node to 6 after a while. The 3 new nodes automatically share the unassigned replicas but not primary shards. Is there a way to achieve this without re-indexing?

Primary and replica shard in most cases do the same amount of work so why does it matter? Elasticsearch manages promotion of shards to primary so it can change at any time even if you manage to get it assigned the way you want.

Indexing is only happening on the primary shards. If I've an indexing rich scanerio this might impact the performance.

If the primary shards are evenly distributed among the data node the indexing whould have been faster. Please correct me if I am wrong.

Indexing also happens on replica shards. The main difference is if you are using e.g. scripted updates where the update is created on the primary.

1 Like

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