背景:
etcd 如何查看 节点属性,比如, leader 还是 flower
环境:
docker 化安装的 etcd集群
测试

  1. 获取 etcdurl
etcdurl=`docker exec etcd ps -o args |grep -v ps |grep -v COMMAND |awk '{print $7}'`

在这里插入图片描述
2. curl获取节点信息
etcd 有一个接口可以获取leader信息
/v2/stats/leader

curl ${etcdurl}/v2/stats/leader

flower节点的输出
在这里插入图片描述
leader节点的输出

{"leader":"bd808d0fa461a88","followers":{"630f756482048e6d":{"latency":{"current":0.000848,"average":0.022868018948820703,"standardDeviation":0.12363015298678447,"minimum":0.000451,"maximum":296.310192},"counts":{"fail":0,"success":326372509}},"e240d98762f39bc":{"latency":{"current":0.001498,"average":0.0224153753830289,"standardDeviation":0.11432724022277063,"minimum":0.000452,"maximum":131.998907},"counts":{"fail":0,"success":316820616}}}}
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐