Loading...

Disable shard allocation of your Elasticsearch nodes

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

If you going to upgrade your cluster or restart a node, it is wise to disable the shard allocation on that node. This prevents Elasticsearch from rebalancing missing shards until you tell it otherwise. This post demonstrates how to disable and enable shard allocation.

Disable it:

vinh@cinhtau:~> curl -XPUT 'http://localhost:9200/_cluster/settings' -d '{
    "transient" : {
        "cluster.routing.allocation.enable" : "none"
    }
}'
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"enable":"none"}}}}}

Perform the upgrade and after the restart enable it:

vinh@cinhtau:~> curl -XPUT 'http://localhost:9200/_cluster/settings' -d '{
    "transient" : {
        "cluster.routing.allocation.enable" : "all"
    }
}'
Please remember the terms for blog comments.