集群分配解释
1.0 版引入
最基本的集群分配解释请求会查找未分配的分片,并解释其无法分配给节点的原因。
如果您添加一些选项,则可以获取特定分片的信息,包括 OpenSearch 将其分配给当前节点的原因。
端点
GET _cluster/allocation/explain
POST _cluster/allocation/explain
查询参数
所有参数都是可选的。
参数 | 类型 | 描述 |
---|---|---|
include_yes_decisions | 布尔型 | OpenSearch 在尝试将分片分配给节点时会做出一系列“是”或“否”的决定。如果此参数为 true,OpenSearch 会在其响应中包含(通常数量更多的)“是”的决定。默认为 false 。 |
include_disk_info | 布尔型 | 是否在响应中包含磁盘使用信息。默认为 false 。 |
请求正文字段
所有集群分配解释字段都是可选的。
字段 | 类型 | 描述 |
---|---|---|
current_node | 字符串 | 如果您只想在分片恰好位于特定节点时获取解释,请在此处指定该节点名称。 |
index | 字符串 | 分片索引的名称。 |
primary | 布尔型 | 是为主要分片(true)还是其第一个副本(false)提供解释,它们共享相同的分片 ID。 |
shard | 整数 | 您想获取解释的分片 ID。 |
请求示例
GET _cluster/allocation/explain?include_yes_decisions=true
{
"index": "movies",
"shard": 0,
"primary": true
}
示例响应
{
"index": "movies",
"shard": 0,
"primary": true,
"current_state": "started",
"current_node": {
"id": "d8jRZcW1QmCBeVFlgOJx5A",
"name": "opensearch-node1",
"transport_address": "172.24.0.4:9300",
"weight_ranking": 1
},
"can_remain_on_current_node": "yes",
"can_rebalance_cluster": "yes",
"can_rebalance_to_other_node": "no",
"rebalance_explanation": "cannot rebalance as no target node exists that can both allocate this shard and improve the cluster balance",
"node_allocation_decisions": [{
"node_id": "vRxi4uPcRt2BtHlFoyCyTQ",
"node_name": "opensearch-node2",
"transport_address": "172.24.0.3:9300",
"node_decision": "no",
"weight_ranking": 1,
"deciders": [{
"decider": "max_retry",
"decision": "YES",
"explanation": "shard has no previous failures"
},
{
"decider": "replica_after_primary_active",
"decision": "YES",
"explanation": "shard is primary and can be allocated"
},
{
"decider": "enable",
"decision": "YES",
"explanation": "all allocations are allowed"
},
{
"decider": "node_version",
"decision": "YES",
"explanation": "can relocate primary shard from a node with version [1.0.0] to a node with equal-or-newer version [1.0.0]"
},
{
"decider": "snapshot_in_progress",
"decision": "YES",
"explanation": "no snapshots are currently running"
},
{
"decider": "restore_in_progress",
"decision": "YES",
"explanation": "ignored as shard is not being recovered from a snapshot"
},
{
"decider": "filter",
"decision": "YES",
"explanation": "node passes include/exclude/require filters"
},
{
"decider": "same_shard",
"decision": "NO",
"explanation": "a copy of this shard is already allocated to this node [[movies][0], node[vRxi4uPcRt2BtHlFoyCyTQ], [R], s[STARTED], a[id=x8w7QxWdQQa188HKGn0iMQ]]"
},
{
"decider": "disk_threshold",
"decision": "YES",
"explanation": "enough disk for shard on node, free: [35.9gb], shard size: [15.1kb], free after allocating shard: [35.9gb]"
},
{
"decider": "throttling",
"decision": "YES",
"explanation": "below shard recovery limit of outgoing: [0 < 2] incoming: [0 < 2]"
},
{
"decider": "shards_limit",
"decision": "YES",
"explanation": "total shard limits are disabled: [index: -1, cluster: -1] <= 0"
},
{
"decider": "awareness",
"decision": "YES",
"explanation": "allocation awareness is not enabled, set cluster setting [cluster.routing.allocation.awareness.attributes] to enable it"
}
]
}]
}