I used this on a ES 5.5 cluster to disable shard allocation and do some maintainance work:
curl -X PUT "http://localhost:9250/_cluster/settings?pretty" \
-H 'Content-Type: application/json' -d \
'{ "persistent": { "cluster.routing.allocation.enable": "none" } }'Then enable shard allocation:
curl -X PUT "http://localhost:9250/_cluster/settings?pretty" \
-H 'Content-Type: application/json' -d \
'{ "persistent": { "cluster.routing.allocation.enable": "all" } }'Used this for ES 1.7:
curl -XPUT -H "Content-Type: application/json" 'http://localhost:9200/_cluster/settings' -d '{
"transient" : {
"cluster.routing.allocation.disable_allocation": "true",
"cluster.routing.allocation.enable": "none",
"index.unassigned.node_left.delayed_timeout": "60m"
}
}'and to re-enable the shard allocation:
curl -XPUT -H "Content-Type: application/json" 'http://localhost:9200/_cluster/settings' -d '{
"transient" : {
"cluster.routing.allocation.disable_allocation": "false",
"cluster.routing.allocation.enable": "all",
"index.unassigned.node_left.delayed_timeout": "1m"
}
}'Finally, checked the cluster health using:
curl -s localhost:9200/_cat/allocation?v