REST APIs —— Cluster APIs —— Cluster allocation explain API(用于提供关于特定分片当前分配情况的解释)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/cluster-allocation-explain.html#cluster-allocation-explain
Provides an explanation for a shard’s current allocation.
提供对 shard 当前分配的解释。
curl -X GET "localhost:9200/_cluster/allocation/explain?pretty" -H 'Content-Type: application/json' -d' { "index": "my-index-000001", "shard": 0, "primary": false, "current_node": "my-node" }'
我理解意思是说: Cluster allocation explain API 是 Elasticsearch 8 中的一个 API,用于提供关于特定分片当前分配情况的解释。使用此 API 可以查看某个集群中特定分片当前所在的节点、分片状态以及分片信息等相关信息。这对于集群管理员来说非常有用,因为他们可以使用此 API 来诊断集群中可能出现的问题,并实时了解集群的健康状况。
1、Request(请求)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/cluster-allocation-explain.html#cluster-allocation-explain-api-request
GET _cluster/allocation/explain POST _cluster/allocation/explain
2、Description(描述)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/cluster-allocation-explain.html#cluster-allocation-explain-api-desc
The purpose of the cluster allocation explain API is to provide explanations for shard allocations in the cluster. For unassigned shards, the explain API provides an explanation for why the shard is unassigned. For assigned shards, the explain API provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node. This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.
Cluster allocation explain API 的目的是提供有关集群中分片分配情况的解释。对于未分配的分片,解释 API 会提供为什么分片未被分配的解释。对于已分配的分片,解释 API 会提供为什么分片仍停留在当前节点而没有移动或重新平衡到其他节点的解释。当故障诊断需要查明为什么分片未被分配或为什么分片继续停留在当前节点时,使用此API非常有用。
3、Unassigned primary shard(未分配的主分片)
https://www.elastic.co/guide/en/elasticsearch/reference/8.8/cluster-allocation-explain.html#_unassigned_primary_shard
The following request gets an allocation explanation for an unassigned primary shard.
以下请求获取未分配的主分片的分配说明。
curl -X GET "localhost:9200/_cluster/allocation/explain?pretty" -H 'Content-Type: application/json' -d' { "index": "my-index-000001", "shard": 0, "primary": true }'标签:cluster,APIs,explain,shard,allocation,Cluster,API,分片 From: https://www.cnblogs.com/zuoyang/p/17501747.html