Force reroute of a primary to a particular node

We are operating a very large ES 7.0 cluster where many indices have no replicas.
Once the index has turned green, is there a way to force reroute its primary shard to another node within the cluster?

Hi @UDixit

you can force all shards of an index to a particular node or group of nodes by using the index filtering API. See its documentation here.

You can't specify where a primary is placed specifically though. That would not be a helpful thing to do in the first place I'd say. If that primary fails for any reason whatsoever, then one of its replicas will take over which would violate any primary allocation setting again. Though if you, as you state have indices that have no replicas then using allocation filtering will obviously force the primaries to the nodes you want them to be on :slight_smile:

Hope that helps

Thanks for the reply.
Let me rephrase the questions.

Once an index has been created and allocated, is there a way to manually rebalance/reroute the primaries of an index (with no replicas)?

Can I force reroute/relocate a Primary shard to any other node( which also meets all allocation filters)?
Will the index be red during this time?

Can I force reroute/relocate a Primary shard to any other node( which also meets all allocation filters)?

You can do that by setting filters such that primaries are forced on the nodes you want them to be on. You can't specifically force a specific shard (by ID) to a certain node as far as I know. What might help you however, is limiting the number of shards of a specific index per node to get closer to the specific allocation you desire. See related docs here

Will the index be red during this time?

No :slight_smile: The relocation of a primary should be fully transparent to writers and readers. A shard will be copied and only once fully recovered on the target node will it become the new primary so there is no downtime. Until it is fully recovered the old node will continue acting as the primary so that writes and reads can continue uninterrupted.

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