0

I have created a ES cluster with ES running on three different machine. In order to make them as cluster i have added the unicast config as below in all the 3 machine in elasticsearch.yml config file.

discovery.zen.ping.unicast.hosts:[IP1, IP2, IP3] 

When i run

curl -XGET localhost:9200/_cluster/health?pretty

Am getting No_of_nodes as 3. Now i wanted to remove one node from the cluster so without changing any config file i ran the below command

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

After this i ran the second command again to get the cluster details, expected output is NO_of_nodes should be 2 but in the result it is showing number of nodes=3 still even after excluding the node. It will of great help if someone can please tell me what is wrong in the steps followed for removing node.

Thanks

Adarsh H D Dev
  • 588
  • 7
  • 29

1 Answers1

2

The command cluster.routing.allocation.exclude._ip that you sent to your cluster will not actually remove the node from your cluster, but rather prepare it for removal. What this does is, it instructs Elasticsearch to move all shards that are held on this node away from this node and store them on other nodes instead. This allows you to then remove the node once it is empty, without causing under-replication of the shards stored on this node.

To actually remove the node from your cluster you would need to remove it from your list of unicast hosts. Of course you can also just shut it down and leave it in the list until you next need to restart your cluster anyway, as far as I am aware that won't hurt anything.

Sönke Liebau
  • 1,943
  • 14
  • 23
  • Thanks for the inputs, I have one more so the entries i made in the unicast is proper right ? I mean to say right in my config file i have made an entry for all 3 nodes in all 3 machine config file is it right way ? – Adarsh H D Dev Feb 15 '17 at 09:55
  • And also with the exclude API it should move the shard under the excluded IP to remaining Nodes right but in my case am still seeing the shards under Node which is marked for excluded. What could be the problem – Adarsh H D Dev Feb 15 '17 at 10:21
  • There are other things that Elasticsearch takes into consideration when trying to reallocate shards (replication factor, disc space, ...) so there could be a number of reasons why in your specific case it is not reallocating the shards. Could you run the allocation explain api (https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html) and create a new question with the output of that? – Sönke Liebau Feb 15 '17 at 10:42
  • I have created the new question http://stackoverflow.com/questions/42248362/shards-are-not-getting-reallocated-from-the-disallocated-node – Adarsh H D Dev Feb 15 '17 at 11:40