查询集群成员
ETCDCTL_API=3 \
etcdctl --cacert="/etc/kubernetes/pki/etcd/server.crt" \
--cert="/etc/kubernetes/pki/etcd/peer.crt" \
--key="/etc/kubernetes/pki/etcd/peer.key" \
--endpoints="https://127.0.0.1:2379" \
member list
保存快照
export ETCDCTL_API=3
etcdctl --cacert="/etc/kubernetes/pki/etcd/server.crt" \
--cert="/etc/kubernetes/pki/etcd/peer.crt" \
--key="/etc/kubernetes/pki/etcd/peer.key" \
--endpoints="https://127.0.0.1:2379" \
snapshot save /data/backup/etcd-snapshot.db
恢复快照
export ETCDCTL_API=3
etcdctl --name=m1 \
--initial-advertise-peer-urls=https://10.211.55.5:2380 \
--initial-cluster=m1=https://10.211.55.5:2380 \
--data-dir=/var/lib/etcd \
snapshot restore /srv/data/etcd-snapshot-previous.db
注:如果没有etcdctl命令的话,可以从docker中复制etcdctl命令
docker cp 371f3ff1f43b:/usr/local/bin/etcdctl /usr/local/bin/etcdctl
多集群可参考:https://github.com/etcd-io/etcd/blob/master/Documentation/op-guide/recovery.md