从etcd api获取集群健康

时间:2017-10-18 03:14:16

标签: etcd

在命令行中,我可以运行以下命令来获取etcd群集的群集运行状况,如下所示:

etcdctl cluster-health
member ac92bd2949b92e96 is healthy: got healthy result from https://172.31.26.170:2379
member bebdb18e18d35331 is healthy: got healthy result from https://172.31.21.117:2379
member c1c4d5cb0d474453 is healthy: got healthy result from https://172.31.18.126:2379

但是,我似乎无法找到API specification中记录的相同功能。如何通过REST API以编程方式确定群集是否健康?

2 个答案:

答案 0 :(得分:1)

etcdctl cluster-health 在 V3 中已弃用,您可以使用以下命令代替:

etcdctl --cluster=true endpoint health

答案 1 :(得分:0)

得到了Github的回答,我以为我会把它传给你 -

没有单个API调用可以返回群集中所有节点的群集运行状况。为此,您需要:

  1. 拨打members API以获取群集中所有成员的列表。

  2. 拨打admin API以获取每个端点的运行状况。