--- title: "源节点在其状态中没有将分片列为已分配在该节点上 - 如何解决此 Elasticsearch 异常" date: 2026-01-25 lastmod: 2026-01-25 description: "当 Elasticsearch 尝试将分片从一个节点移动到另一个节点,但源节点没有将分片列为分配给它时,会出现此错误。这可能是由于集群状态不一致或网络问题造成的。" tags: ["分片恢复", "节点分配", "集群状态", "异常处理"] summary: "版本: 6.8-8.9 简而言之,当 Elasticsearch 尝试将分片从一个节点移动到另一个节点,但源节点没有将分片列为分配给它时,会出现此错误。这可能是由于集群状态不一致或网络问题造成的。要解决此问题,您可以尝试使用集群重新路由 API 手动重新路由分片,或者重新启动节点以刷新其状态。如果问题仍然存在,请考虑检查集群的健康状况,并确保所有节点都已正确连接和同步。 日志上下文 # 日志"source node does not have the shard listed in its state as allocated on the node"类名是 RecoverySourceHandler.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用: logger.debug( "delaying recovery of {} as it is not listed as assigned to target node {}"; request.shardId(); request.targetNode() ); throw new DelayRecoveryException("source node does not have the shard listed in its state as allocated on the node"); } assert targetShardRouting." --- > **版本:** 6.8-8.9 简而言之,当 Elasticsearch 尝试将分片从一个节点移动到另一个节点,但源节点没有将分片列为分配给它时,会出现此错误。这可能是由于集群状态不一致或网络问题造成的。要解决此问题,您可以尝试使用集群重新路由 API 手动重新路由分片,或者重新启动节点以刷新其状态。如果问题仍然存在,请考虑检查集群的健康状况,并确保所有节点都已正确连接和同步。 日志上下文 ----------- 日志"source node does not have the shard listed in its state as allocated on the node"类名是 [RecoverySourceHandler.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用: ```java logger.debug( "delaying recovery of {} as it is not listed as assigned to target node {}"; request.shardId(); request.targetNode() ); throw new DelayRecoveryException("source node does not have the shard listed in its state as allocated on the node"); } assert targetShardRouting.initializing() : "expected recovery target to be initializing but was " + targetShardRouting; retentionLeaseListener.onResponse( shard.getRetentionLeases().get(ReplicationTracker.getPeerRecoveryRetentionLeaseId(targetShardRouting)) ); ```