首页/数据/NoSQL 速查/allocation explain 定位未分配分片
Elasticsearch89 条

allocation explain 定位未分配分片

分片一直 UNASSIGNED 时,allocation explain 给出分配决策链与原因(如磁盘水位、分配过滤规则、已有同分片副本无法共存),并附带可执行的修复建议。

NoSQL 速查数据更新于 2026-10-12
接口POST /_cluster/allocation/explain
请求体{"index": "...", "shard": 0, "primary": true}
返回current_state、can_allocate、allocate_explanation、node_allocation_decisions

示例

示例
POST /_cluster/allocation/explain
{
  "index": "logs-2024.01",
  "shard": 0,
  "primary": false
}

# 不知道哪块未分配时,直接请求接口不加参数
GET /_cluster/allocation/explain

易错点

  • 揭示的原因链可能是多层的:先解决第一层(如水位)再看后续,别同时改多个设置
  • 旧数据节点被下线后同名节点未回归时,副本原因常显示 node_left,需要确认节点规划而不是强行 reroute

数据来源与参考

  • Elasticsearch Guide: Cluster allocation explain API
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌