ES cannot allocate because the cluster is still waiting 234h for the departed node holding a replica to rejoin despite being allowed to allocate the shard to at least one other node 如何处理
要解决这个问题,可以尝试以下几个步骤:
- 首先,确保已经从集群中彻底删除了已经离开的节点。可以通过使用Elasticsearch的API来执行此操作。例如,使用以下命令删除已经离开的节点:
DELETE /_cluster/state/_node/{node_id}
其中,{node_id}是已经离开的节点的ID。
- 如果已经删除了离开的节点,并且集群状态已经更新,但是仍然无法分配副本到其他节点,可以尝试使用以下命令手动分配副本:
POST /_cluster/reroute
{
"commands": [
{
"allocate_replica": {
"index": "your_index",
"shard": shard_number,
"node": "target_node",
"allow_primary": true
}
}
]
}
将your_index替换为索引名称,shard_number替换为分片号,target_node替换为目标节点的ID或名称。
这将强制Elasticsearch将副本分配给目标节点。请注意,这可能会导致其他节点的负载增加,因此在进行此操作之前,请确保目标节点有足够的资源来处理额外的副本。
- 如果上述步骤仍然无法解决问题,可以尝试重新启动整个集群。这将导致集群重新分配所有分片和副本,并可能解决问题。
请注意,在执行任何更改之前,请确保备份重要的数据,并在生产环境中慎重操作
原文地址: https://www.cveoy.top/t/topic/iG53 著作权归作者所有。请勿转载和采集!