- etcd版本: v3.4.14
- 部署平台: 单台云服务器(ipaddr使用内网ip)
- copy时需要将集群启动cli中的一下参数做出修改:
1.data-dir
2.listen-peer-urls
3.listen-client-urls
4.initial-advertise-peer-urls
5.advertise-client-urls
1.pkg以及目录
mkdir /data/etcd_clustr/
cd /data/etcd_clustr/
wget https://github.com/etcd-io/etcd/releases/download/v3.4.14/etcd-v3.4.14-linux-amd64.tar.gz
tar xf etcd-v3.4.14-linux-amd64.tar.gz -C
mv etcd-v3.4.14-linux-amd64 etcd1
cp -r /data/etcd_cluster/etcd1 /data/etcd_cluster/etcd2
cp -r /data/etcd_cluster/etcd1 /data/etcd_cluster/etcd3
集群启动
1.etcd1
- 以下为一条命令
nohup cd /data/etcd_cluster/etcd1 \
&& ./etcd --name="etcd-1" \
--data-dir="/data/etcd_cluster/etcd1/default.etcd" \
--listen-peer-urls="http://192.168.0.51:3002" \
--listen-client-urls="http://192.168.0.51:3001" \
--initial-advertise-peer-urls="http://192.168.0.51:3002" \
--advertise-client-urls="http://192.168.0.51:3001" \
--initial-cluster="etcd-1=http://192.168.0.51:3002,etcd-2=http://192.168.0.51:3004,etcd-3=http://192.168.0.51:3006" \
>/dev/null 2>&1 &
2.etcd2
nohup cd /data/etcd_cluster/etcd2 \
&& ./etcd --name="etcd-2" \
--data-dir="/data/etcd_cluster/etcd2/default.etcd" \
--listen-peer-urls="http://192.168.0.51:3004" \
--listen-client-urls="http://192.168.0.51:3003" \
--initial-advertise-peer-urls="http://192.168.0.51:3004" \
--advertise-client-urls="http://192.168.0.51:3003" \
--initial-cluster="etcd-1=http://192.168.0.51:3002,etcd-2=http://192.168.0.51:3004,etcd-3=http://192.168.0.51:3006" \
>/dev/null 2>&1 &
3.etcd3
nohup cd /data/etcd_cluster/etcd3 \
&& ./etcd --name="etcd-3" \
--data-dir="/data/etcd_cluster/etcd3/default.etcd" \
--listen-peer-urls="http://192.168.0.51:3006" \
--listen-client-urls="http://192.168.0.51:3005" \
--initial-advertise-peer-urls="http://192.168.0.51:3006" \
--advertise-client-urls="http://192.168.0.51:3005" \
--initial-cluster="etcd-1=http://192.168.0.51:3002,etcd-2=http://192.168.0.51:3004,etcd-3=http://192.168.0.51:3006" \
>/dev/null 2>&1 &
集群状态
- ENV
echo "export EP=--endpoints=192.168.0.51:3001,192.168.0.51:3003,192.168.0.51:3005" >> /etc/profile && source /etc/profile
- status
# status:
etcdctl --write-out=table $EP endpoint status
# health
etcdctl --write-out=table $EP endpoint health