Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch: evacuate all data before shutdown of a data node?

Is there a way to tell a node to remove all of its data (spread it back out among the other nodes) so that I can shut it down and not deal with a rebalance/re-replicate once its down?

If I have 2 copies of each shard, and I drop one node, some of the shards now only have 1 live copy and it has to be re-replicated. I'd prefer to not drop down to 1 live copy for any period of time if I can.

like image 441
Nate Fox Avatar asked Jan 10 '14 22:01

Nate Fox


1 Answers

After posting to the ES mailing list, I was informed the proper answer lies in the _cluster/settings api, specifically the cluster.routing.allocation.exclude._ip option.

From the docs: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-cluster.html

curl -XPUT localhost:9200/_cluster/settings -d '{
  "transient" : {
    "cluster.routing.allocation.exclude._ip" : "10.0.0.1"
  }
}'

The IP address can be a comma separated list. To 'un-exclude', just remove the IP from the list (or set the list to "" to remove all excluded IPs).

Hopefully this helps others looking for the answer to this same question.

like image 170
Nate Fox Avatar answered Sep 25 '22 04:09

Nate Fox