How to remove Elasticsearch node(s)

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}
    



    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
    



    Reference

    좋은 웹페이지 즐겨찾기