Elasticsearch index.routing.allocation.exclude._name Setting

The index.routing.allocation.exclude._name setting in Elasticsearch is used to control shard allocation by excluding specific nodes based on their names. This setting allows you to prevent an index's shards from being allocated to certain nodes in your cluster.

  • Default value: Not set (empty)
  • Possible values: Comma-separated list of node names or wildcard patterns
  • Recommendations: Use this setting judiciously to fine-tune shard allocation based on your cluster's architecture and requirements

This setting is part of the index-level shard allocation settings. It works in conjunction with other allocation settings to provide granular control over where shards are placed within your Elasticsearch cluster.

Example

To exclude shards of an index named "my_index" from being allocated to nodes named "node1" and "node2", you can use the following cluster settings API call:

PUT /my_index/_settings
{
  "index.routing.allocation.exclude._name": "node1,node2"
}

You might want to change this setting when performing maintenance on specific nodes, or when you have specialized nodes that should not host certain indices.

The effect of this change will be that Elasticsearch will attempt to move any shards of "my_index" currently on node1 or node2 to other eligible nodes, and will not allocate new shards of this index to these excluded nodes.

Common Issues and Misuses

  • Overuse of exclusion rules can lead to unbalanced shard distribution
  • Excluding too many nodes may result in unallocated shards if there are not enough eligible nodes remaining
  • Forgetting to remove exclusions after maintenance can cause long-term allocation issues

Do's and Don'ts

  • Do use this setting for temporary exclusions during maintenance
  • Do combine with other allocation settings for more complex rules
  • Don't use this as a primary means of long-term cluster organization
  • Don't exclude all available nodes for an index, as this will result in unallocated shards

Frequently Asked Questions

Q: Can I use wildcards in the node name exclusion list?
A: Yes, you can use wildcards. For example, "node*" would exclude all nodes whose names start with "node".

Q: How does this setting interact with index.routing.allocation.include._name?
A: The exclude setting takes precedence over the include setting. If a node is in both lists, it will be excluded.

Q: Will changing this setting cause immediate shard relocation?
A: Yes, Elasticsearch will start the reallocation process immediately, but the speed depends on your cluster's current state and load.

Q: Can I use this setting to move all shards off a node before decommissioning it?
A: Yes, this is a common use case. Exclude the node you want to decommission, wait for shards to relocate, then safely remove the node.

Q: Is there a limit to how many node names I can exclude?
A: There's no hard limit, but be cautious not to exclude too many nodes, as it may lead to allocation problems if there aren't enough eligible nodes remaining.

Subscribe to the Pulse Newsletter

Get early access to new Pulse features, insightful blogs & exclusive events , webinars, and workshops.

We use cookies to provide an optimized user experience and understand our traffic. To learn more, read our use of cookies; otherwise, please choose 'Accept Cookies' to continue using our website.