cluster health

cluster health API能够得到一个非常简单的集群健康状态。

$ curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
{
  "cluster_name" : "testcluster",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 5,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}

这个API也能在一个或多个索引上执行,得到指定索引的健康状态:

$ curl -XGET 'http://localhost:9200/_cluster/health/test1,test2'

集群健康状态是:green,yellow和red。在分片层次上,一个red状态表明这个指定的分片没有分配,yellow表示主分片分配但副本没有分配,green表示所有的分片都已经分配。索引级别的状态由分片的最差状态决定。集群状态由最差的索引状态控制。

这个API的主要好处之一是能够等到集群达到一定高的级别。例如,下面的指令在集群达到yellow状态前会等待50s(在50s前,如果达到green或yellow状态,则返回):

$ curl -XGET 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s'


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值