故障etcd 节点 加入现有集群
恢复步骤:
1、查看故障节点的etcd状态并关闭服务
systemctl status etcd && systemctl stop etcd
2、列出现有的集群节点ID
ETCDCTL_API=3 /opt/etcd/bin/etcdctl --cacert=/opt/etcd/ssl/ca.pem --cert=/opt/etcd/ssl/server.pem --key=/opt/etcd/ssl/server-key.pem --endpoints="https://x.x.x.2:2379,https://x.x.x.3:2379,https://x.x.x.4:2379" member list -w table
3、通过ID 删除故障节点
ETCDCTL_API=3 /opt/etcd/bin/etcdctl --cacert=/opt/etcd/ssl/ca.pem --cert=/opt/etcd/ssl/server.pem --key=/opt/etcd/ssl/server-key.pem --endpoints="https://x.x.x.2:2379,https://x.x.x.3:2379,https://x.x.x.4:2379"
member remove 48ccac483b85c1bd
4、删除故障节点的原数据目录
rm /var/lib/etcd/default.etcd/* -rf
5、修改故障ETCD 节点的 配置文件
/opt/etcd/cfg/etcd.conf 修改ETCD_INITIAL_CLUSTER_STATE="new" 为 ETCD_INITIAL_CLUSTER_STATE="existing"
6、把故障节点加入到现有集群
ETCDCTL_API=3 /opt/etcd/bin/etcdctl --cacert=/opt/etcd/ssl/ca.pem --cert=/opt/etcd/ssl/server.pem --key=/opt/etcd/ssl/server-key.pem --endpoints="https://x.x.x.2:2379,https://x.x.x.3:2379,https://x.x.x.4:2379" member add x.x.x.4 --peer-urls=https://x.x.x.4:2380
7、 查看集群状态,状态为unstarted 需要重新启动etcd
ETCDCTL_API=3 /opt/etcd/bin/etcdctl --cacert=/opt/etcd/ssl/ca.pem --cert=/opt/etcd/ssl/server.pem --key=/opt/etcd/ssl/server-key.pem --endpoints="https://x.x.x.2:2379,https://x.x.x.3:2379,https://x.x.x.4:2379" member list -w table
8、 重新启动故障节点etcd服务并重启apiserver 服务,再次查看ETCD集群状态就是 started 状态
systemctl start etcd
9、至此 数据会从其他2个节点同步到新加入的节点
标签:opt,etcd,ssl,--,pem,集群,https,节点 From: https://www.cnblogs.com/zbhlinux/p/17217634.html