elasticsearch system_error ai_generated true

PrimaryShardNotAllocatedException: 主分片未分配

PrimaryShardNotAllocatedException: primary shard is not allocated

ID: elasticsearch/primary-shard-not-allocated

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-11-20首次发现

版本兼容性

版本状态引入弃用备注
elasticsearch 8.9 active
elasticsearch 8.10 active
elasticsearch 7.17 active
opensearch 2.7 active

根因分析

由于分配决策规则、磁盘空间不足或节点故障,主分片无法分配到任何节点。

English

A primary shard cannot be assigned to any node due to allocation decider rules, disk space, or node failures.

generic

官方文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html

解决方案

  1. 使用_allocation/explain检查分配原因,并修复根本问题(如释放磁盘空间、调整路由设置)。
  2. 如果因节点故障导致,重新启用分配。
  3. 手动将分片分配到特定节点,需确认节点健康。

无效尝试

常见但无效的做法:

  1. 70% 失败

    If the allocation decider blocks (e.g., disk threshold), reroute is rejected; the underlying issue persists.

  2. 95% 失败

    Data loss occurs; the problem is not diagnosed and may reappear for new indices.

  3. 80% 失败

    Replicas require a primary shard first; increasing replicas does not help if primary is unallocated.