码迷,mamicode.com
首页 > 其他好文 > 详细

ETCD集群部署

时间:2018-04-18 19:10:48      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:etcd

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

ETCD集群部署

标签:etcd

原文地址:http://blog.51cto.com/11889458/2105040

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!