elasticsearch
config_error
ai_generated
true
主分片未分配异常:主分片 [my_index][0] 未分配,因为节点版本 [7.10.2] 与索引版本 [7.17.0] 不兼容
PrimaryShardNotAllocatedException: primary shard [my_index][0] not allocated because node version [7.10.2] is incompatible with index version [7.17.0]
ID: elasticsearch/primary-shard-not-allocated-due-to-node-version-mismatch
85%修复率
85%置信度
1证据数
2024-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.10.2 | active | — | — | — |
| 7.17.0 | active | — | — | — |
| 8.0.0 | active | — | — | — |
根因分析
较旧版本的 Elasticsearch 节点无法托管由较新版本创建的主分片,因为 Lucene 段格式不兼容。
English
A node with an older Elasticsearch version cannot host a primary shard created by a newer version due to Lucene segment format incompatibility.
官方文档
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/rolling-upgrades.html解决方案
-
Upgrade the older node's Elasticsearch version to match the index version (e.g., from 7.10.2 to 7.17.0) using rolling upgrade: `sudo systemctl stop elasticsearch`, replace package, restart, and wait for shard allocation.
-
Reindex the data to a new index with compatible settings: `POST _reindex { "source": { "index": "my_index" }, "dest": { "index": "my_index_v2" } }` then delete old index and use alias.
无效尝试
常见但无效的做法:
-
95% 失败
Node version does not change on restart; manual upgrade is required.
-
85% 失败
Data is lost and the root cause (version mismatch) remains if other nodes are still newer.