您的位置:首页 > 其它

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

2017-05-27 14:52 323 查看
因为在生产中直接拷贝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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐