使用 man ascii 来查看 ASCII 表。

ES reroute会不会与 rebalance 产生"冲突"?导致reroute后的分片又被rebalance到其他节点上了?

Elasticsearch | 作者 hapjin | 发布于2019年08月06日 | 阅读数:2948

因为我在官方文档cluster-reroute看到这段话:


It is important to note that after processing any reroute commands Elasticsearch will perform rebalancing as normal (respecting the values of settings such as cluster.routing.rebalance.enable) in order to remain in a balanced state. For example, if the requested allocation includes moving a shard from node1 to node2 then this may cause a shard to be moved from node2 back to node1 to even things out.


其大意是:ES reroute之后会执行rebalance,如果使用reroute 将分片A 从node1迁移到node2,可能会触发ES rebalance又把分片A 从node2 再均衡回到node1了?
那难道使用了reroute命令迁移分片之后,必须得禁用Rebalance了?因为如果不禁用Rebalance的话,reroute可能并没有真正生效啊。但是禁用了Rebalance,又不能充分利用ES提供的"负载均衡"能力了。
已邀请:

bellengao - 博客: https://www.jianshu.com/u/e0088e3e2127

赞同来自:

感觉手动执行reroute只有在异常情况下才有用,如果集群运行稳定,就利用rebalance功能自动均衡分片就好了,不需要手动执行reroute

hapjin

赞同来自:

不知道有那种"一次性" 迁移一个索引下所有的分片的命令,感觉reroute太麻烦了,运行一次命令只能迁移一个分片
POST /_cluster/reroute
{
"commands": [
{
"move": {
"index": "loginmac-201905",
"shard": 0,
"from_node": "node-151",
"to_node": "node-11"
}
}
]
}

由于 loginmac-201905 索引有5个分片,那要完全reroute完这个索引到 node-11节点,需要运行5次命令。

要回复问题请先登录注册