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

版本: 7.1-8.9

简而言之,当 Elasticsearch 无法从 leader 集群上获取指定索引的主分片统计信息时,会出现此错误。这可能是由于网络问题、权限不足,或者分片和索引不可用导致的。要解决此问题,请确保网络连接稳定,已授予必要的权限,并且分片和索引可用且未处于故障状态。此外,请检查集群健康状况并确保其为 green 状态。如果问题仍然存在,请考虑重新索引或重新定位分片。

日志上下文 #

日志 “Could not get shard stats for primary of index ” + leaderIndex + “ on leader cluster” 的类名是 CcrRepository.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

// we only care about the shard size here for shard allocation; populate the rest with dummy values
final long totalSize = shardStats.getStats().getStore().getSizeInBytes();
return IndexShardSnapshotStatus.newDone(0L, 0L, 1, 1, totalSize, totalSize, DUMMY_GENERATION);
}
}
throw new ElasticsearchException("Could not get shard stats for primary of index " + leaderIndex + " on leader cluster");
}

@Override
public void updateState(ClusterState state) {}