centos7下etcd集群安装

etcd版本:etcd-v3.3.9-linux-amd64.tar.gz

etcd各版本下载地址:https://github.com/etcd-io/etcd/releases

本次集群中使用3台服务器节点,分别是:

节点1:192.168.108.128

节点2:192.168.108.129

节点3:192.168.108.130

 

#创建etcd配置文件目录

#mkdir  /etc/etcd

#创建etcd配置文件

#vi /etc/etcd/conf.yml

节点1配置文件内容如下:

name: etcd-1
data-dir: /opt/etcd-v3.3.9/data
listen-client-urls: http://192.168.108.128:2379,http://127.0.0.1:2379
advertise-client-urls: http://192.168.108.128:2379,http://127.0.0.1:2379
listen-peer-urls: http://192.168.108.128:2380
initial-advertise-peer-urls: http://192.168.108.128:2380
initial-cluster: etcd-1=http://192.168.108.128:2380,etcd-2=http://192.168.108.129:2380,etcd-3=http://192.168.108.130:2380
initial-cluster-token: etcd-cluster-token
initial-cluster-state: new

 

节点2配置文件内容如下:

name: etcd-2
data-dir: /opt/etcd-v3.3.9/data
listen-client-urls: http://192.168.108.129:2379,http://127.0.0.1:2379
advertise-client-urls: http://192.168.108.129:2379,http://127.0.0.1:2379
listen-peer-urls: http://192.168.108.129:2380
initial-advertise-peer-urls: http://192.168.108.129:2380
initial-cluster: etcd-1=http://192.168.108.128:2380,etcd-2=http://192.168.108.129:2380,etcd-3=http://192.168.108.130:2380
initial-cluster-token: etcd-cluster-token
initial-cluster-state: new

 

节点3配置文件内容如下:

name: etcd-3
data-dir: /opt/etcd-v3.3.9/data
listen-client-urls: http://192.168.108.130:2379,http://127.0.0.1:2379
advertise-client-urls: http://192.168.108.130:2379,http://127.0.0.1:2379
listen-peer-urls: http://192.168.108.130:2380
initial-advertise-peer-urls: http://192.168.108.130:2380
initial-cluster: etcd-1=http://192.168.108.128:2380,etcd-2=http://192.168.108.129:2380,etcd-3=http://192.168.108.130:2380
initial-cluster-token: etcd-cluster-token
initial-cluster-state: new

 

更新etcd系统默认配置
当前使用的是etcd v3版本,系统默认的是v2,通过下面命令修改配置。

# vi /etc/profile

在文件末尾追加:

export ETCDCTL_API=3

让更改生效:

# source /etc/profile

 

集群启动:

在每台服务器节点上执行命令:

# ./etcd --config-file=/etc/etcd/conf.yml

 

集群启动成功后,

查看集群成员信息:

# ./etcdctl member list

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值