集群状态查询

  • Post author:
  • Post category:其他


一、获取集群状态的API:

1、请求:GET _cluster/health

2、响应:

{


“cluster_name”: “elasticsearch_zach”,

“status”: “green”,

“timed_out”: false,

“number_of_nodes”: 1,

“number_of_data_nodes”: 1,

“active_primary_shards”: 10, #集群中的主分片数量

“active_shards”: 10,#所有索引的所有分片的汇总值,即包括副本分片。

“relocating_shards”: 0,#当前正在从一个节点迁往其他节点的分片的数量

“initializing_shards”: 0,#刚刚创建的分片的个数

“unassigned_shards”: 0#是已经在集群状态中存在的分片,但是实际在集群里又找不着

}

3、status 字段

green:所有的主分片和副本分片都正常运行

yellow:所有的主分片都正常运行,但不是所有的副本分片都正常运行。

red:有主分片没能正常运行。

4、查询集群的索引清单

GET _cluster/health?level=indices

5、查询集群更详细的信息

GET _cluster/health?level=shards



版权声明:本文为duzm200542901104原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。