etcd安装配置

下载安装包

选择不同系统的安装包,也可以自己编译
wget https://github.com/etcd-io/etcd/releases/download/v3.3.13/etcd-v3.3.13-linux-amd64.tar.gz

解压缩加入环境变量

-- 解压缩
tar -zxvf etcd-v3.3.13-linux-amd64.tar.gz
export ETCD_HOME=/opt/etcd/etcd-v3.3.13
export PATH=$PATH:$ETCD_HOME
-- 检查是否生效
etcd -version

启动单机版

etcd
etcd -listen-client-urls="http://0.0.0.0:2379" --advertise-client-urls="http://0.0.0.0:2379"
-- 查看是否生效
curl http://172.19.0.2:2379/version

配置单机多节点

配置node1.yml

name: node01
data-dir: /opt/etcd/data/node1
listen-client-urls: http://172.19.0.2:10001,http://127.0.0.1:10001
advertise-client-urls: http://172.19.0.2:10001
initial-advertise-peer-urls: http://172.19.0.2:9001
listen-peer-urls: http://172.19.0.2:9001
#初始化名称
#initial-cluster-token: token-test-cluster
#初始化群集列表
initial-cluster: node01=http://172.19.0.2:9001,node02=http://172.19.0.2:9002,node03=http://172.19.0.2:9003
#初始化状态(new|existing)
initial-cluster-state: new

配置node2.yml

name: node02
data-dir: /opt/etcd/data/node2
listen-client-urls: http://172.19.0.2:10002,http://127.0.0.1:10002
advertise-client-urls: http://172.19.0.2:10002
initial-advertise-peer-urls: http://172.19.0.2:9002
listen-peer-urls: http://172.19.0.2:9002
#初始化名称
#initial-cluster-token: token-test-cluster
#初始化群集列表
initial-cluster: node01=http://172.19.0.2:9001,node02=http://172.19.0.2:9002,node03=http://172.19.0.2:9003
#初始化状态(new|existing)
initial-cluster-state: new

配置node3.yml

name: node03
data-dir: /opt/etcd/data/node3
listen-client-urls: http://172.19.0.2:10003,http://127.0.0.1:10003
advertise-client-urls: http://172.19.0.2:10003
initial-advertise-peer-urls: http://172.19.0.2:9003
listen-peer-urls: http://172.19.0.2:9003
#初始化名称
#initial-cluster-token: token-test-cluster
#初始化群集列表
initial-cluster: node01=http://172.19.0.2:9001,node02=http://172.19.0.2:9002,node03=http://172.19.0.2:9003
#初始化状态(new|existing)
initial-cluster-state: new

启动服务

nohup etcd  --config-file=/opt/etcd/node1.yml > /opt/etcd/node1.out &
nohup etcd  --config-file=/opt/etcd/node2.yml > /opt/etcd/node2.out &
nohup etcd  --config-file=/opt/etcd/node3.yml > /opt/etcd/node3.out &
--  如果不需要日志,可以输出到/dev/null
nohup etcd  --config-file=/opt/etcd/node1.yml > /dev/null &

检测成功与否

etcdctl --endpoints http://172.19.0.2:10001,http://172.19.0.2:10002,http://172.19.0.2:10003 member list
etcdctl --endpoints http://172.19.0.2:10001,http://172.19.0.2:10002,http://172.19.0.2:10003 set /cqh muscle

UI操作界面(etcd-browser和etcdkeeper)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值