1、关闭节点分配,使上面的shard强制迁移到其他节点上
curl -XPUT localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{
"transient" :{
"cluster.routing.allocation.exclude._ip" : "node_ip1,node_ip2"
}
}'
等待shard reroute完成后再继续下一步
2、在剩余节点中将配置discovery.seed_hosts和 cluster.initial_master_nodes 中删掉要下线节点ip。不需要重启es进程
3、关机下线。注意zabbix和salt里要删掉
备注
# 更改cluster_concurrent_rebalance、node_concurrent_recoveries数量来加快分片的转移:注意集群负载
curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'
{
"transient": {
"cluster.routing.allocation.cluster_concurrent_rebalance": 15,
"cluster.routing.allocation.node_concurrent_recoveries": 15
}
}'
# 确定集群shard reroute是否完成
#查看是否有正在RELOCATING分片
curl -s "http://localhost:9200/_cat/shards" | grep RELOCATING
#查看集群健康状态
curl http://localhost:9200/_cluster/health?pretty
#查看节点上indices信息
curl http://localhost:9200/_nodes/‘被移除节点’/stats/indices?pretty
3、最后将刚开始添加的配置修改为默认