安全重启elasticsearch节点
刷新到磁盘
1
2[root@ip-172-31-90-193 ~]# curl -XGET http://172.31.90.193:9200/_flush
{"_shards":{"total":152,"successful":152,"failed":0}}先暂停集群的shard自动均衡
1
2
3
4
5
6
7[root@ip-172-31-90-193 ~]# curl -XPUT http://172.31.90.193:9200/_cluster/settings -d '
> {
> "transient" : {
> "cluster.routing.allocation.enable" : "none"
> }
> }'
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"enable":"none"}}}}}停止node节点
1
2
3
4
5
6[root@ip-172-31-90-193 ~]# curl -XGET http://172.31.90.193:9200/_cat/nodes?v
host ip heap.percent ram.percent load node.role master name
172.31.90.193 172.31.90.193 34 99 2.07 d * Molten Man
172.31.90.45 172.31.90.45 43 99 0.75 d m node-2
[root@ip-172-31-90-193 ~]# curl -XPOST http://192.168.1.3:9200/_cluster/nodes/_local/_shutdown启动node节点
开启集群的shard自动均衡
1
2
3
4
5
6
7[root@ip-172-31-90-193 ~]# curl -XPUT http://172.31.90.193:9200/_cluster/settings -d'
> {
> "transient" : {
> "cluster.routing.allocation.enable" : "all"
> }
> }'
{"acknowledged":true,"persistent":{},"transient":{"cluster":{"routing":{"allocation":{"enable":"all"}}}}}