etcd恢复备份-自己的研究做了改进成功了,官网的没成功不知道为何

因为在生产中直接拷贝DB比较方便且也比较符合生产中的实际情况,所以我用的是直接拷贝db数据的方式,所以恢复数据的时候加了参数  --skip-hash-check

恢复数据:

ETCDCTL_API=3 ./etcdctl snapshot restore ../db \

  --name m1 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-advertise-peer-urls http://192.168.75.145:2380 \
  --skip-hash-check
  
ETCDCTL_API=3 ./etcdctl snapshot restore ../db \
  --name m2 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-advertise-peer-urls http://192.168.75.145:3380 \
  --skip-hash-check
  
ETCDCTL_API=3 ./etcdctl snapshot restore ../db \
  --name m3 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-advertise-peer-urls http://192.168.75.145:4380 \
  --skip-hash-check
  
 创建集群:(绿色的是官网的做法,一直没成功,执行etcdctl命令总是出现Error:  grpc: timed out when dialing。实在没把发,我用了写出全部参数的方法成功)
./etcd \
  --name m1 \
  --listen-client-urls http://192.168.75.145:2379 \
  --advertise-client-urls http://192.168.75.145:2379 \
  --listen-peer-urls http://192.168.75.145:2380 

  
 ./etcd --name m1 --initial-advertise-peer-urls http://192.168.75.145:2380 \
  --listen-peer-urls http://192.168.75.145:2380 \
  --listen-client-urls http://192.168.75.145:2379,http://127.0.0.1:2379 \
  --advertise-client-urls http://192.168.75.145:2379 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-state new
  
./etcd \
  --name m2 \
  --listen-client-urls http://192.168.75.145:3379 \
  --advertise-client-urls http://192.168.75.145:3379 \
  --listen-peer-urls http://192.168.75.145:3380 

  
./etcd --name m2 --initial-advertise-peer-urls http://192.168.75.145:3380 \
  --listen-peer-urls http://192.168.75.145:3380 \
  --listen-client-urls http://192.168.75.145:3379,http://127.0.0.1:3379 \
  --advertise-client-urls http://192.168.75.145:3379 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-state new
  
./etcd \
  --name m3 \
  --listen-client-urls http://192.168.75.145:4379 \
  --advertise-client-urls http://192.168.75.145:4379 \
  --listen-peer-urls http://192.168.75.145:4380 

  
 ./etcd --name m3 --initial-advertise-peer-urls http://192.168.75.145:4380 \
  --listen-peer-urls http://192.168.75.145:4380 \
  --listen-client-urls http://192.168.75.145:4379,http://127.0.0.1:4379 \
  --advertise-client-urls http://192.168.75.145:4379 \
  --initial-cluster-token etcd-cluster-1 \
  --initial-cluster m1=http://192.168.75.145:2380,m2=http://192.168.75.145:3380,m3=http://192.168.75.145:4380 \
  --initial-cluster-state new
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值