ETCD 聚群部署
1.环境
- 172.16.50.121 morepay01 CentOS 7.4.1708
- 172.16.50.122 morepay02 CentOS 7.4.1708
- 172.16.50.123 morepay03 CentOS 7.4.1708
2.部署
2.1 软件安装
yum install etcd -y && mkdir /data/etcd -p && chown etcd:etcd /data/etcd
2.2 配置文件修改
/etc/etcd/etcd.conf
ETCD_NAME={{nodename}}
ETCD_DATA_DIR="/data/etcd"
ETCD_LISTEN_PEER_URLS="http://{{ip}}:2380"
ETCD_LISTEN_CLIENT_URLS="http://{{ip}}:2379,http://127.0.0.1:2379"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://{{ip}}:2380"
ETCD_INITIAL_CLUSTER="morepay01=http://172.16.50.121:2380,morepay02=http://172.16.50.122:2380,morepay03=http://172.16.50.123:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-00"
ETCD_ADVERTISE_CLIENT_URLS="http://{{ip}}:2379"
{{nodename}} 为节点主机名;{{ip}} 为节点IP地址
2.3 设置开机启动
systemctl enable etcd.service
2.4 启动etcd
systemctl start etcd.service
2.5 验证集群信息
集群健康检查
etcdctl cluster-health
member 6ef9f9e1c48e3b03 is healthy: got healthy result from http://172.16.50.122:2379
member 78c34c60566053a0 is healthy: got healthy result from http://172.16.50.123:2379
member 91c17220a0ff42a4 is healthy: got healthy result from http://172.16.50.121:2379
cluster is healthy
集群成员管理
etcdctl member list
6ef9f9e1c48e3b03: name=morepay02 peerURLs=http://172.16.50.122:2380 clientURLs=http://172.16.50.122:2379 isLeader=false
78c34c60566053a0: name=morepay03 peerURLs=http://172.16.50.123:2380 clientURLs=http://172.16.50.123:2379 isLeader=false
91c17220a0ff42a4: name=morepay01 peerURLs=http://172.16.50.121:2380 clientURLs=http://172.16.50.121:2379 isLeader=true
原文地址:http://blog.51cto.com/11889458/2105040
时间: 2024-10-04 07:09:39