Elasticsearch index.routing.allocation.exclude.<custom_attribute> Setting

The index.routing.allocation.exclude.<custom_attribute> setting allows you to exclude specific nodes from hosting shards of an index based on custom node attributes. This provides fine-grained control over index shard allocation in Elasticsearch clusters.

  • Default value: Not set
  • Possible values: Comma-separated list of attribute values to exclude
  • Recommendations: Use this setting judiciously to ensure balanced shard distribution and avoid overloading specific nodes.

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

Example

To exclude shards of an index from nodes with a custom attribute "rack" value of "rack1" or "rack2":

PUT /my-index/_settings
{
  "index.routing.allocation.exclude.rack": "rack1,rack2"
}

This change might be desired to avoid placing shards on specific racks for better fault tolerance or to free up resources on certain nodes.

Common Issues or Misuses

  1. Over-constraining shard allocation, leading to unassigned shards
  2. Conflicting allocation rules between include, require, and exclude settings
  3. Forgetting to remove or update exclusion rules when cluster topology changes

Do's and Don'ts

  • Do use this setting in combination with other allocation settings for balanced distribution
  • Do regularly review and update allocation settings as your cluster evolves
  • Don't set overly restrictive allocation rules that might prevent shard assignment
  • Don't forget to consider the impact on cluster balance and performance when excluding nodes

Frequently Asked Questions

Q: Can I use wildcards in the attribute values for exclusion?
A: Yes, you can use wildcards (*) in the attribute values to match multiple nodes with similar attributes.

Q: How does this setting interact with index.routing.allocation.include.?
A: The exclude setting takes precedence over include. If a node matches both an include and an exclude rule, it will be excluded.

Q: Can I set this at the cluster level instead of per-index?
A: While similar settings exist at the cluster level, this specific setting is index-level. For cluster-wide rules, use cluster-level routing allocation settings.

Q: What happens if all nodes are excluded for an index?
A: If all nodes are excluded, the shards will remain unassigned, potentially impacting the availability of the index.

Q: How quickly do changes to this setting take effect?
A: Changes are typically applied during the next shard allocation round, which usually happens quickly but can depend on cluster state and activity.

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.