如何获取弹性ser簇的副本号

时间:2019-09-16 10:14:50

标签: elasticsearch

我有一个在AWS上运行的Elasticsearch实例。以下是群集运行状况数据:

{
  "cluster_name": "553479592532:test-perf",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 6,
  "active_shards": 6,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 5,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 54.54545454545454
}

从上面的输出中,我可以看到有1个节点和6个分片。已将6个分片分配给该节点,并且有5个未分配的分片。但是我怎么知道副本的数量?

1 个答案:

答案 0 :(得分:1)

您可以使用索引api,它会列出集群中的所有索引及其主要和副本分片。由于您的主要分片数量已经很少,因此您甚至无法在集群中获得大量索引。

API:= http://localhost:9200/_cat/indices?v,在这里用弹性主机替换localhost。

编辑:根据文档,OP提供的回复来自cluster health API,并且根据官方ES文档:

  

active_primary_shards(整数):活动的主分片的数量。

     

active_shards(整数):活动的主数据库和副本数据库的总数   碎片。

我也在本地进行了测试,通过查看active_shards可以正常工作,您显然没有任何副本碎片。。您基本上可以从active_primary_shards中减去active_shards的值。