Elasticsearch index.routing.allocation.include._publish_ip Setting

What is index.routing.allocation.include._publish_ip?

The index.routing.allocation.include._publish_ip setting in Elasticsearch is used to control shard allocation based on the publish address of nodes. It allows you to specify which nodes should host shards of a particular index based on their IP addresses.

Description

  • Default value: Not set
  • Possible values: IP addresses or IP ranges (comma-separated)
  • Recommendations: Use this setting when you need to allocate shards to specific nodes based on their network location or to implement network topology-aware shard allocation.

This setting is part of the index-level shard allocation filtering mechanism. It works in conjunction with other include, exclude, and require settings to provide fine-grained control over where Elasticsearch allocates shards.

Example

To allocate shards of an index only to nodes with specific IP addresses:

PUT /my-index/_settings
{
  "index.routing.allocation.include._publish_ip": "192.168.1.1,192.168.1.2"
}

This change would cause Elasticsearch to allocate shards of my-index only to nodes with the publish IP addresses 192.168.1.1 or 192.168.1.2. You might want to do this to ensure that certain indices are only stored on nodes in a specific network segment or data center.

Common Issues or Misuses

  • Overuse of this setting can lead to unbalanced cluster states if not carefully managed.
  • Incorrect IP address specification can result in shards not being allocated at all.
  • Changing this setting on an existing index can cause significant shard relocation, potentially impacting cluster performance.

Do's and Don'ts

  • Do use this setting in combination with other allocation settings for more precise control.
  • Do consider the network topology and data locality when using this setting.
  • Don't rely solely on IP-based allocation without considering other factors like node roles and resources.
  • Don't frequently change this setting, as it can lead to unnecessary shard migrations.

Frequently Asked Questions

Q: Can I use wildcards in the IP address specification?
A: Yes, you can use wildcards. For example, "192.168.1.*" would match all IP addresses in the 192.168.1.0/24 subnet.

Q: How does this setting interact with other allocation settings?
A: This setting is combined with other allocation settings using AND logic. All conditions must be met for a shard to be allocated to a node.

Q: Will changing this setting cause immediate shard relocation?
A: Yes, changing this setting can trigger shard relocation to comply with the new allocation rules, which may impact cluster performance.

Q: Can I use this setting to separate hot and cold nodes?
A: While possible, it's generally better to use node attributes or roles for hot/cold architectures rather than IP-based allocation.

Q: Is this setting applied at the cluster level or index level?
A: This is an index-level setting. Each index can have its own allocation rules based on publish IP addresses.

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.