#1.查看节点成员
ETCDCTL_API=3 etcdctl --endpoints="https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key member list
758dd97f0270ef21, started, etcd002, https://172.18.0.72:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
c2c355104508da65, started, etcd001, https://172.18.0.71:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
f50ec904d2191ff1, started, etcd003, https://172.18.0.73:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
#2.查看集群状态
etcdctl --endpoints="https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key endpoint health
https://172.18.0.73:2379 is healthy: successfully committed proposal: took = 77.547023ms
https://172.18.0.72:2379 is healthy: successfully committed proposal: took = 77.547898ms
https://172.18.0.71:2379 is healthy: successfully committed proposal: took = 77.668481ms
#3.删除其中172.18.0.73(etcd003)成员
ETCDCTL_API=3 etcdctl --endpoints="https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key member remove f50ec904d2191ff1
Member f50ec904d2191ff1 removed from cluster ab80a2c2c9182c05
#4.验证成员
ETCDCTL_API=3 etcdctl --endpoints="https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key member list
758dd97f0270ef21, started, etcd002, https://172.18.0.72:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
c2c355104508da65, started, etcd001, https://172.18.0.71:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
#5.清空旧etcd003节点数据
rm -rf /var/lib/etcd/member
#6.修改要重新加入集群的etcd003节点的启动参数
sed -i 's/ETCD_INITIAL_CLUSTER_STATE="new"/ETCD_INITIAL_CLUSTER_STATE="existing"/g' /etc/etcd/etcd.conf
#7.从etcd-master拷贝证书(第5列为true代表master)
etcdctl --endpoints="https://172.18.0.71:2379,https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/e
tcd.key endpoint status
https://172.18.0.71:2379, c2c355104508da65, 3.5.12, 20 kB, false, false, 3, 17, 17,
https://172.18.0.72:2379, 758dd97f0270ef21, 3.5.12, 20 kB, true, false, 3, 17, 17,
scp -rp 172.18.0.72:/etc/etcd/ /etc/etcd/
#8.节点成员重新添加etcd003
ETCDCTL_API=3 etcdctl --endpoints="https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key member add etcd003 --peer-urls=https://172.18.0.73:2380
Member 90f13aed73f1d9e3 added to cluster ab80a2c2c9182c05
#9.再次查看节点成员
ETCDCTL_API=3 etcdctl --endpoints="https://172.18.0.72:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key member list
758dd97f0270ef21, started, etcd002, https://172.18.0.72:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
90f13aed73f1d9e3, unstarted, , https://172.18.0.73:2380, , false
c2c355104508da65, started, etcd001, https://172.18.0.71:2380, https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379, false
#10.重启etcd003服务
systemctl daemon-reload && systemctl restart etcd
#11.查看集群状态
etcdctl --endpoints="https://172.18.0.71:2379,https://172.18.0.72:2379,https://172.18.0.73:2379" --cacert=/etc/etcd/ca.pem --cert=/etc/etcd/etcd.pem --key=/etc/etcd/etcd.key endpoint health
https://172.18.0.72:2379 is healthy: successfully committed proposal: took = 51.896718ms
https://172.18.0.71:2379 is healthy: successfully committed proposal: took = 51.831718ms
https://172.18.0.73:2379 is healthy: successfully committed proposal: took = 55.209259ms
