WARNING: Version 2.4 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Shard Allocation Filtering
editShard Allocation Filtering
editWhile Index Shard Allocation provides per-index settings to control the allocation of shards to nodes, cluster-level shard allocation filtering allows you to allow or disallow the allocation of shards from any index to particular nodes.
The typical use case for cluster-wide shard allocation filtering is when you want to decommission a node, and you would like to move the shards from that node to other nodes in the cluster before shutting it down.
For instance, we could decommission a node using its IP address as follows:
PUT /_cluster/settings { "transient" : { "cluster.routing.allocation.exclude._ip" : "10.0.0.1" } }
Shards will only be relocated if it is possible to do so without breaking another routing constraint, such as never allocating a primary and replica shard to the same node.
Cluster-wide shard allocation filtering works in the same way as index-level shard allocation filtering (see Index Shard Allocation for details).
The available dynamic cluster settings are as follows, where {attribute}
refers to an arbitrary node attribute.:
-
cluster.routing.allocation.include.{attribute}
-
Assign the index to a node whose
{attribute}
has at least one of the comma-separated values. -
cluster.routing.allocation.require.{attribute}
-
Assign the index to a node whose
{attribute}
has all of the comma-separated values. -
cluster.routing.allocation.exclude.{attribute}
-
Assign the index to a node whose
{attribute}
has none of the comma-separated values.
These special attributes are also supported:
|
Match nodes by node name |
|
Match nodes by IP address (the IP address associated with the hostname) |
|
Match nodes by hostname |
All attribute values can be specified with wildcards, eg:
PUT _cluster/settings { "transient": { "cluster.routing.allocation.exclude._ip": "192.168.2.*" } }