版本: 8.9-8.9
简而言之,当 Elasticsearch 无法为索引找到活动的主分片时,就会发生此错误。这可能是由于节点故障、网络分区或负载过重导致分片无响应引起的。要解决此问题,你可以尝试重启 Elasticsearch 节点,检查集群的健康状况并确保所有节点都已连接,或者如果负载过高,则增加系统资源。如果可以接受数据丢失,你可以删除并重新创建索引。但是,确定根本原因以防止再次发生至关重要。
日志上下文 #
日志"primary shard is not active"类名称是 TransportGetAction.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:
} static DiscoveryNode getCurrentNodeOfPrimary(ClusterState clusterState; ShardId shardId) {
var shardRoutingTable = clusterState.routingTable().shardRoutingTable(shardId);
if (shardRoutingTable.primaryShard() == null || shardRoutingTable.primaryShard().active() == false) {
throw new NoShardAvailableActionException(shardId; "primary shard is not active");
}
DiscoveryNode node = clusterState.nodes().get(shardRoutingTable.primaryShard().currentNodeId());
assert node != null;
return node;
}





