由于修改配置等原因,elasticsearch需要重启节点,如果操作不当会造成整个集群崩溃,主要是因为elasticsearch有再平衡策略,就是当一个节点停机,整个集群就开始执行再平衡策略,集群开始移动分片,elasticsearch的健康状态不再是绿色。
可以通过集群API 关闭再平衡策略,再进行节点重启:
1,put http://localhost:9092/_cluster/settings
{
"transient" : {
"cluster.routing.allocation.enable" : "none"
}
}
2,重启一个节点
3,put http://localhost:9092/_cluster/settings
{
"transient" : {
"cluster.routing.allocation.enable" : "all"
}
}
重复上面的步骤,全部重启所有节点
本文介绍了一种安全重启Elasticsearch节点的方法,通过暂时禁用再平衡策略避免集群崩溃,确保了节点重启过程中的数据稳定性和集群健康状态。
700

被折叠的 条评论
为什么被折叠?



