--- title: "主分片未激活 shards= active= - 如何解决此 Elasticsearch 异常" date: 2026-02-22 lastmod: 2026-02-22 description: "当 Elasticsearch 无法找到任何活动的主分片时会发生此错误。这可能是由于网络问题、磁盘空间问题或节点故障等原因造成的。" tags: ["主分片", "分片激活", "集群健康", "异常处理"] summary: " 版本: 7.13-8.9 简而言之,当 Elasticsearch 无法找到任何活动的主分片时,就会出现此错误。这可能是由于多种原因造成的,例如网络问题、磁盘空间问题或节点故障。要解决此问题,你可以尝试重启 Elasticsearch 集群、检查是否存在网络问题、确保有足够的磁盘空间,或检查节点的健康状况。如果问题仍然存在,你可能需要重新索引数据。 日志上下文 # 日志"Primary shards were not active [shards={}; active={}]“的类名是 GetGlobalCheckpointsAction.java。我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: handleIndexNotReady(state; request; listener); } else { int active = routingTable.primaryShardsActive(); int total = indexMetadata.getNumberOfShards(); listener.onFailure( new UnavailableShardsException(null; "Primary shards were not active [shards={}; active={}]"; total; active) ); } } } " --- > **版本:** 7.13-8.9 简而言之,当 Elasticsearch 无法找到任何活动的主分片时,就会出现此错误。这可能是由于多种原因造成的,例如网络问题、磁盘空间问题或节点故障。要解决此问题,你可以尝试重启 Elasticsearch 集群、检查是否存在网络问题、确保有足够的磁盘空间,或检查节点的健康状况。如果问题仍然存在,你可能需要重新索引数据。 日志上下文 ----------- 日志"Primary shards were not active [shards={}; active={}]"的类名是 [GetGlobalCheckpointsAction.java](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/)。我们从 Elasticsearch 源代码中提取了以下内容,为那些寻求深入上下文的人提供参考: ```java handleIndexNotReady(state; request; listener); } else { int active = routingTable.primaryShardsActive(); int total = indexMetadata.getNumberOfShards(); listener.onFailure( new UnavailableShardsException(null; "Primary shards were not active [shards={}; active={}]"; total; active) ); } } } ```