elasticsearch
system_error
ai_generated
true
PrimaryShardNotAllocatedException: 主分片未分配
PrimaryShardNotAllocatedException: primary shard is not allocated
ID: elasticsearch/primary-shard-not-allocated
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.
官方文档
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html解决方案
-
使用_allocation/explain检查分配原因,并修复根本问题(如释放磁盘空间、调整路由设置)。
-
如果因节点故障导致,重新启用分配。
-
手动将分片分配到特定节点,需确认节点健康。
无效尝试
常见但无效的做法:
-
70% 失败
If the allocation decider blocks (e.g., disk threshold), reroute is rejected; the underlying issue persists.
-
95% 失败
Data loss occurs; the problem is not diagnosed and may reappear for new indices.
-
80% 失败
Replicas require a primary shard first; increasing replicas does not help if primary is unallocated.