简单的配置Etcd集群 3.0 3个节点IP 192.168.134.140 192.168.134.141 192.168.134.142 3.1 下载etcd curl -L https://github.com/coreos/etcd/releases/download/v2.3.6/etcd-v2.3.6-linux-amd64.tar.gz -o etcd-v2.3.6-linux-amd64.tar.gz 3.2 tar xzvf etcd-v2.3.6-linux-amd64.tar.gz && cd etcd-v2.3.6-linux-amd64 3.3 mv etcd etcdctl /bin 3.4 新建目录 mkdir -p /data/etcddata (存放etcd数据) 3.5 在192.168.134.140 上执行命令 etcd -name etcd0 -initial-advertise-peer-urls http://192.168.134.140:2380 -listen-peer-urls http://192.168.134.140:2380 -listen-client-urls http://192.168.134.140:2379,http://127.0.0.1:2379 -advertise-client-urls http://192.168.134.140:2379 -initial-cluster-token my-etcd-cluster -initial-cluster etcd0=http://192.168.134.140:2380,etcd1=http://192.168.134.141:2380,etcd2=http://192.168.134.142:2380 --data-dir=/data/etcddata -initial-cluster-state new &
3.6 在192.168.134.141 上执行命令 etcd -name etcd1 -initial-advertise-peer-urls http://192.168.134.141:2380 -listen-peer-urls http://192.168.134.141:2380 -listen-client-urls http://192.168.134.141:2379,http://127.0.0.1:2379 -advertise-client-urls http://192.168.134.141:2379 -initial-cluster-token my-etcd-cluster -initial-cluster etcd0=http://192.168.134.140:2380,etcd1=http://192.168.134.141:2380,etcd2=http://192.168.134.142:2380 --data-dir=/data/etcddata -initial-cluster-state new &
3.7 在192.168.134.142 上执行命令 etcd -name etcd2 -initial-advertise-peer-urls http://192.168.134.142:2380 -listen-peer-urls http://192.168.134.142:2380 -listen-client-urls http://192.168.134.142:2379,http://127.0.0.1:2379 -advertise-client-urls http://192.168.134.142:2379 -initial-cluster-token my-etcd-cluster -initial-cluster etcd0=http://192.168.134.140:2380,etcd1=http://192.168.134.141:2380,etcd2=http://192.168.134.142:2380 --data-dir=/data/etcddata -initial-cluster-state new & 注:启动上面3个命令屏幕会刷日志,关掉终端,重新开个ssh连接 ,使用命令检查 etcd集群是否正常 etcdctl cluster-health 正常情况
时间: 2024-11-28 23:26:34