etcd数据恢复

作者: admin 分类: linux 发布时间: 2017-06-23 16:57 ė 6 没有评论

误删了线上etcd数据,但是索性做了备份.
3个节点全挂。只剩备份数据

首先启动3个机器 分别是master01 master02 master03
如何恢复 看步骤
首先在master03的机器上解压缩备份数据
1,tar xvf etcd.tar
2,cd etcd
3,nohup etcd -name master03 -initial-advertise-peer-urls http://master03:2380 -advertise-client-urls http://master03:2379 -listen-peer-urls http://0.0.0.0:2380 -listen-client-url
s http://0.0.0.0:2379 -force-new-cluster -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &
稍等1分钟后 执行pkill etcd
在master03继续执行如下命令
nohup etcd -name master03 -initial-advertise-peer-urls http://master03:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-listen-client-urls http://0.0.0.0:2379 \
-advertise-client-urls http://master03:2379 \
-initial-cluster-token etcd-cluster-2 \
-initial-cluster master01=http://master01:2380,master02=http://master02:2380,master03=http://master03:2380 \
-initial-cluster-state new -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &
在执行
etcdctl member add master02 http://10.0.0.248:2380

接下来在master02上执行如下命令
删除/opt/etcd/etc的数据
nohup etcd -name master02 -initial-advertise-peer-urls http://master02:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-listen-client-urls http://0.0.0.0:2379 \
-advertise-client-urls http://master02:2379 \
-initial-cluster-token etcd-cluster-2 \
-initial-cluster master02=http://master02:2380,master03=http://master03:2380\
-initial-cluster-state existing -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &

接下来在master01上执行如下命令
删除/opt/etcd/etc的数据
nohup etcd -name master01 -initial-advertise-peer-urls http://master01:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-listen-client-urls http://0.0.0.0:2379 \
-advertise-client-urls http://master01:2379 \
-initial-cluster-token etcd-cluster-2 \
-initial-cluster master01=http://master01:2380,master02=http://master02:2380,master03=http://master03:2380 \
-initial-cluster-state existing -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &

当执行完以后 在master03上执行
etcdctl member add master01 http://10.0.0.248:2380
在执行etcd member list 查看集群节点
etcdctl cluster-health 查看集群是否健康

本文出自 小Q,转载时请注明出处及相应链接。

本文永久链接: http://www.linuxqq.com/archives/1692.html

0
更多
Ɣ回顶部