多主机搭建etcd集群
HOST1:101.200.243.176(公网)172.17.229.160(内网) HOST2:110.43.50.186(公网)10.0.0.254(内网)
[root@peiqi test]# tar xzvf etcd-v3.4.10-linux-amd64.tar.gz [root@peiqi test]# mv etcd-v3.4.10-linux-amd64 etcd && cd etcd [root@peiqi etcd]# ./etcd --name docker01 --listen-peer-urls http://172.17.229.160:2380 --listen-client-urls http://172.17.229.160:2379,http://127.0.0.1:2379 --initial-advertise-peer-urls http://101.200.243.176:2380 --advertise-client-urls http://127.0.0.1:2379,http://101.200.243.176:2379 --initial-cluster docker01=http://101.200.243.176:2380,docker02=http://110.43.50.186:2380 --initial-cluster-token etcd-cluster --initial-cluster-state new
HOST2
[root@qiaozhi test]# tar xzvf etcd-v3.4.10-linux-amd64.tar.gz [root@qiaozhi test]# mv etcd-v3.4.10-linux-amd64 etcd && cd etcd [root@qiaozhi etcd]# ./etcd --name docker02 --listen-peer-urls http://10.0.0.254:2380 --listen-client-urls http://10.0.0.254:2379,http://127.0.0.1:2379 --initial-advertise-peer-urls http://110.43.50.186:2380 --advertise-client-urls http://127.0.0.1:2379,http://110.43.50.186:2379 --initial-cluster docker01=http://101.200.243.176:2380,docker02=http://110.43.50.186:2380 --initial-cluster-token etcd-cluster --initial-cluster-state new
[root@peiqi etcd]# ./etcdctl member list 23311ae1cecb97ad, started, docker01, http://101.200.243.176:2380, http://101.200.243.176:2379,http://127.0.0.1:2379, false d95dada82a934bb0, started, docker02, http://110.43.50.186:2380, http://110.43.50.186:2379,http://127.0.0.1:2379, false