--- title: "分片不再重新定位 - 如何解决此Elasticsearch异常" date: 2026-02-13 lastmod: 2026-02-13 description: "当正在重新定位到Elasticsearch集群中另一个节点的分片已完成重新定位或重新定位过程被中断时,会出现此错误" tags: ["分片", "重新定位", "节点", "集群健康"] summary: " 版本: 7.16-8.9 简而言之,当一个正在重新定位到Elasticsearch集群中另一个节点的分片已完成其重新定位或重新定位过程被中断时,会出现此错误。这可能是由于网络问题、节点故障或手动干预造成的。要解决此问题,您可以检查集群健康状态和各个节点的状态。如果存在网络问题,请修复它们。如果节点发生故障,您可能需要重启它或添加新节点。如果重新定位是手动停止的,如有必要,您可能需要重新启动它。 日志上下文 # 日志": shard is no longer relocating"的类名是 IndexShard.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: * that we concurrently end up here and therefore have to protect that we do not mark the shard as relocated when its shard routing * says otherwise. */ if (shardRouting.relocating() == false) { throw new IllegalIndexShardStateException(shardId; IndexShardState.STARTED; ": shard is no longer relocating " + shardRouting); } if (primaryReplicaResyncInProgress.get()) { throw new IllegalIndexShardStateException( shardId; " --- > **版本:** 7.16-8.9 简而言之,当一个正在重新定位到Elasticsearch集群中另一个节点的分片已完成其重新定位或重新定位过程被中断时,会出现此错误。这可能是由于网络问题、节点故障或手动干预造成的。要解决此问题,您可以检查集群健康状态和各个节点的状态。如果存在网络问题,请修复它们。如果节点发生故障,您可能需要重启它或添加新节点。如果重新定位是手动停止的,如有必要,您可能需要重新启动它。 日志上下文 ----------- 日志": shard is no longer relocating"的类名是[IndexShard.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解上下文的人使用: ```java * that we concurrently end up here and therefore have to protect that we do not mark the shard as relocated when its shard routing * says otherwise. */ if (shardRouting.relocating() == false) { throw new IllegalIndexShardStateException(shardId; IndexShardState.STARTED; ": shard is no longer relocating " + shardRouting); } if (primaryReplicaResyncInProgress.get()) { throw new IllegalIndexShardStateException( shardId; ```