1

I am running a three node (elasticsearch) cluster currently with index.number_of_replicas: 0. I'd like to bring one of the node down for maintenance. Do I have any options to do this without increasing number_of_replicas?

Shutdown API does not seem to rebalance the shards before shutdown of the node. So, it looks like I need to use the cluster reroute API to manually move the shards to another node. Doing so would like rebalance other shards back to my node, so I guess I would need to somehow rebalance the cluster. Is there any better option that this?

Ztyx
  • 1,365
  • 3
  • 13
  • 27

1 Answers1

3

You can decommission a node by telling the cluster to exclude it from allocation. (From the documentation here)

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

This will cause Elasticsearch to allocate the shards on that node to the remaining nodes, without the state of the cluster changing to yellow or red (even if you have replication 0).

Once all the shards have been reallocated you can shutdown the node and do whatever you need to do there. Once you're done, include the node for allocation and Elasticsearch will rebalance the shards again.

Answer copied from https://stackoverflow.com/a/23905040/260805

Ztyx
  • 1,365
  • 3
  • 13
  • 27