2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

How to remove Elasticsearch node(s)

Last updated at Posted at 2018-12-12

How to remove Elasticsearch node(s)

  • 3 nodes -> 1 node

from Elasticsearch Master node

$ curl -X PUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
  "transient" :{
      "cluster.routing.allocation.exclude._ip" : "xxx.xxx.xxx.xxx"
   }
}'
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"exclude":{"_ip":"xxx.xxx.xxx.xxx"}}}}}}

shutdown elasticsearch node to be removed

systemctl stop elasticsearch

edit /etc/elasticsearch/elasticsearch.yml

  • discovery.zen.ping.unicast.hosts
  • discovery.zen.minimum_master_nodes: 3 -> (none)
/etc/elasticsearch/elasticsearch.yml
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes: 

set replica = 0 !

curl -XPUT 'localhost:9200/_settings' -H 'Content-Type: application/json' -d '
{
    "index" : {
        "number_of_replicas" : 0
    }
}'
{"acknowledged":true}

image.png

then repeat

$ curl -X PUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
  "transient" :{
      "cluster.routing.allocation.exclude._ip" : "yyy.yyy.yyy.yyy"
   }
}'
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"exclude":{"_ip":"xxx.xxx.xxx.xxx"}}}}}}

shutdown elasticsearch node to be removed

systemctl stop elasticsearch

:smile:

Reference

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?