etcd 集群故障恢复

备份db

tar -zcvf etcd.tar.gz /var/lib/etcd/ 

  

恢复故障机器

拷贝备份好的etcd.tar.gz

rm -rf /var/lib/etcd 

export ETCDCTL_API=3
etcdctl snapshot restore db  --data-dir=/var/lib/etcd\
  --name sd-node83 \
  --initial-cluster sd-node82=http://172.31.40.82:2380,sd-node83=http://172.31.40.83:2380,sd-node84=http://172.31.40.84:2380 \
  --initial-cluster-token etcd-cluster-sdn \
  --initial-advertise-peer-urls http://172.31.40.83:2380 --skip-hash-check

授权
chown -R etcd:etcd /var/lib/etcd
启动 systemctl start etcd

查看集权状态

export ETCDCTL_API=2

etcdctl  cluster-health

member 5b2b7cf88370539d is healthy: got healthy result from http://172.31.40.83:2379
member 8fb71bb07a8e1652 is healthy: got healthy result from http://172.31.40.82:2379
member e2e5984c3c8ff4fc is healthy: got healthy result from http://172.31.40.84:2379
原文地址:https://www.cnblogs.com/hanwei666/p/15710070.html