索引分片存储

原文链接 : https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-shards-stores.html

译文链接 : 索引分片存储

贡献者 : 飞师傅

提供索引的副本分片的存储信息。存储信息包括了:哪些节点存储分片副本,分片副本分配的ID,每个分片的唯一标识符以及打开分片索引时甚至更早期的引擎异常。

默认情况下,只有至少一个未分配的副本分片的列表存储信息。当集群健康状态为yellow时,将列出具有至少一个未分配副本分片的存储信息。当集群健康状态为red时,将列出具有未分配主分片的存储信息。

端点包括特定索引,多个索引或全部分片的存储信息:

  1. curl -XGET 'http://localhost:9200/test/_shard_stores'
  2. curl -XGET 'http://localhost:9200/test1,test2/_shard_stores'
  3. curl -XGET 'http://localhost:9200/_shard_stores'

列出存储信息的分片范围可以通过status参数变更。默认为yellowredyellow列出至少一个未分配副本分片的信息,red列出有未分配的主分片的信息。使用green列出所有已分配的副本分片信息。

  1. curl -XGET 'http://localhost:9200/_shard_stores?status=green'

响应:

分片存储信息按索引和分片ID分组。

  1. {
  2. ...
  3. "0": {
  4. "stores": [
  5. {
  6. "sPa3OgxLSYGvQ4oPs-Tajw": {
  7. "name": "node_t0",
  8. "transport_address": "local[1]",
  9. "attributes": {
  10. "mode": "local"
  11. }
  12. },
  13. "allocation_id": "2iNySv_OQVePRX-yaRH_lQ",
  14. "legacy_version": 42,
  15. "allocation" : "primary" | "replica" | "unused",
  16. "store_exception": ...
  17. },
  18. ...
  19. ]
  20. },
  21. ...
  22. }

① 这个键是存储信息对应的分片id

②所有分片副本的存储信息列表

③副本托管存储的节点信息,这个键是唯一节点id

④存储副本分片的id

⑤存储副本的版本(仅适用于在当前版本的 Elasticsearch 中尚未激活的旧版分区副本)

⑥存储副本的状态,无论用作主存储、副本存储还是不使用的副本。

⑦打开分片索引或更早引擎故障时遇到的异常信息。