A cluster with etcd containers is created successfully.
Check the cluster status with the following command.docker
# etcdctl --endpoint cluster-health
If the cluster is running normally, the output looks like:json
member xxx is healthy: got healthy result from https://10.23.2.109:3379 member xxx is healthy: got healthy result from https://10.23.2.108:3379 member xxx is healthy: got healthy result from https://10.23.2.110:3379 cluster is healthy
If one member failed, the output may look like:bash
failed to check the health of member xxx on https://10.23.2.109:3379: Get https://10.23.2.109:3379/health: dial tcp 10.23.2.109:3379: connect: connection refused member xxx is unreachable: [https://10.23.2.109:3379] are all unreachable member xxx is healthy: got healthy result from https://10.23.2.108:3379 member xxx is healthy: got healthy result from https://10.23.2.110:3379 cluster is healthy
The reason may meet one of the following four cases.tcp
# etcdctl member remove xxx
xxx is memberID of the unreachable member.
"ETCD_INITIAL_CLUSTER_STATE": "existing" "ETCD_INITIAL_CLUSTER": <The cluster peer urls with the new etcd container>
"hostname2=https://10.23.2.108:3380,hostname3=https://10.23.2.110:3380" in ETCD_INITIAL_CLUSTER are the peer urls of the cluster after removing the destroyed member.url
# etcdctl --endpoint member add <name> <peerURL>
<name> is hostname in its config file.rest
<peerURL> is one of ETCD_INITIAL_ADVERTISE_PEER_URLS in its config file.code
Start the container.orm
# docker start <container>
Restart the stopped etcd container.rem
# docker restart <container>
If a member is unhealthy, we can refer to above case 2 to remove its container with metadata, then create a new one to fix it.get