ETCD集群部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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集群部署的主要内容,如果未能解决你的问题,请参考以下文章

kubernetes容器集群部署Etcd集群

k8s-外置ETCD集群部署

一键部署ETCD集群脚本

部署etcd集群

2etcd单机部署和集群部署

ETCD集群部署