版本: 6.8-8.9
简而言之,当您尝试在Elasticsearch中恢复跨集群复制(CCR)会话时,如果分片已关闭,就会出现此错误。分片需要处于打开状态才能恢复会话。要解决此问题,您可以使用"打开索引"API手动打开分片,或者确保集群配置在尝试恢复操作时自动打开已关闭的索引。此外,请检查集群健康状况,确保没有导致分片意外关闭的潜在问题。
日志上下文 #
日志"cannot open ccr restore session if shard closed"(如果分片关闭则无法打开ccr恢复会话)的类名是 CcrRestoreSourceService.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用:
logger.debug("not opening new session [{}] as it already exists"; sessionUUID);
restore = onGoingRestores.get(sessionUUID);
} else {
logger.debug("opening session [{}] for shard [{}]"; sessionUUID; indexShard.shardId());
if (indexShard.state() == IndexShardState.CLOSED) {
throw new IndexShardClosedException(indexShard.shardId(); "cannot open ccr restore session if shard closed");
}
final Engine.IndexCommitRef commitRef = indexShard.acquireSafeIndexCommit();
final SetfileNames = Set.copyOf(commitRef.getIndexCommit().getFileNames());
restore = new RestoreSession(sessionUUID; indexShard; commitRef; fileNames; scheduleTimeout(sessionUUID));
onGoingRestores.put(sessionUUID; restore);





