How elasticsearch restarts nodes safely

In an elasticsearch cluster, sometimes you may need to modify the configuration, increase the hard disk, expand the memory, etc., and you need to maintain and upgrade the nodes. However, the business cannot be stopped. If the node is directly killed, data loss may occur. Moreover, the cluster will think that the node is down and start transferring data. When it restarts, it will restore the data. If your current data volume is already large, it will consume a lot of machine and network resources.
This article reproduces the officially provided method for safely restarting cluster nodes:

Step 1: First suspend the automatic shard balancing of the cluster.

1
2
3
4
5
6
curl -XPUT http://192.168.1.2:9200/_cluster/settings -d'
{
    "transient" : {
        "cluster.routing.allocation.enable" : "none"
    }
}'
Step 2 :shutdown the node you want to upgrade

1
curl -XPOST http://192.168.1.3:9200/_cluster/nodes/_local/_shutdown
Step 3: Upgrade and restart the node, and confirm that the node has rejoined the cluster Step

4 : Repeat steps 2-3 to upgrade and restart other nodes to be upgraded.

Step 5: Restart the shard balance of the cluster

1
2
3
4
5
6
curl -XPUT http://192.168.1.2/_cluster/settings -d'
{
    "transient" : {
        "cluster.routing.allocation.enable" : "all"
    }
}'
to this whole cluster is safely upgraded and restarted end.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326654615&siteId=291194637