How to remove node from elasticsearch cluster on runtime without down time

前端 未结 2 1477
遥遥无期
遥遥无期 2020-12-07 11:14

Suppose I had 5 nodes in cluster and I had to remove 2 node on run-time. So how it can be done without affecting the indices?

I had continuous stream of data coming

2条回答
  •  盖世英雄少女心
    2020-12-07 11:40

    To remove elasticsearch node from the cluster just run the following command

    curl -XPUT P.P.P.P:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
      "transient" :{
          "cluster.routing.allocation.exclude._ip" : "X.X.X.X"
       }
    }';echo
    

    Here P.P.P.P is the private IP of the master node, you may also use the localhost if elasticsearch is running on localhost. X.X.X.X is the private IP of the node to be removed from the cluster.

    This command will give acknowledgement true if the node is accepted to be removed and the data relocation will start. Check if the data relocation is over and the node doesn't have any shards left on it, than stop elasticsearch process and stop/terminate the instance. The commands to check data relocation and shards left can be found on this article.

提交回复
热议问题