📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-8.9

简而言之,当Elasticsearch中的分片在恢复过程中被关闭,从而导致恢复被取消时,就会发生此错误。这可能是由于节点离开或加入集群,或者是由于手动干预造成的。要解决此问题,你可以尝试重启Elasticsearch节点,或使用集群重新路由API手动重新路由分片。如果问题仍然存在,请检查集群健康状况,确保节点或网络不存在潜在问题。

日志上下文 #

日志"shard is closed and recovery was canceled reason [" + reason + “]“的类名是 RecoverySourceHandler.java。 我们从Elasticsearch源代码中提取了以下内容,以便为那些寻求深入上下文的人提供参考:

final Closeable releaseResources = () -> IOUtils.close(resources);
 try {
 cancellableThreads.setOnCancel((reason; beforeCancelEx) -> {
 final RuntimeException e;
 if (shard.state() == IndexShardState.CLOSED) { // check if the shard got closed on us
 e = new IndexShardClosedException(shard.shardId(); "shard is closed and recovery was canceled reason [" + reason + "]");
 } else {
 e = new CancellableThreads.ExecutionCancelledException("recovery was canceled reason [" + reason + "]");
 }
 if (beforeCancelEx != null) {
 e.addSuppressed(beforeCancelEx);