ETCD一台机器上起集群(多台机器一个原理)

昨天本来想部署一台测试的ETCD 但是网上搜了半天也没个资料 大多数据都是复制粘贴的没办法凡事都得靠自己

etcd1.conf

name: etcd1
data-dir: /usr/local/etcd1/data
listen-client-urls: http://127.0.0.1:12379
advertise-client-urls: http://127.0.0.1:12379
listen-peer-urls: http://127.0.0.1:12380
initial-advertise-peer-urls: http://127.0.0.1:12380
initial-cluster: etcd1=http://127.0.0.1:12380,etcd2=http://127.0.0.1:22380,etcd3=http://127.0.0.1:32380
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new

etcd2.conf

name: etcd2
data-dir: /usr/local/etcd2/data
listen-client-urls: http://127.0.0.1:22379
advertise-client-urls: http://127.0.0.1:22379
listen-peer-urls: http://127.0.0.1:22380
initial-advertise-peer-urls: http://127.0.0.1:22380
initial-cluster: etcd1=http://127.0.0.1:12380,etcd2=http://127.0.0.1:22380,etcd3=http://127.0.0.1:32380
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new

etce3.conf

name: etcd3
data-dir: /usr/local/etcd3/data
listen-client-urls: http://127.0.0.1:32379
advertise-client-urls: http://127.0.0.1:32379
listen-peer-urls: http://127.0.0.1:32380
initial-advertise-peer-urls: http://127.0.0.1:32380
initial-cluster: etcd1=http://127.0.0.1:12380,etcd2=http://127.0.0.1:22380,etcd3=http://127.0.0.1:32380
initial-cluster-token: etcd-cluster-1
initial-cluster-state: new

启动

/usr/local/etcd1/etcd/etcd --config-file=/usr/local/etcd1/etcd.conf

/usr/local/etcd2/etcd/etcd --config-file=/usr/local/etcd2/etcd.conf

/usr/local/etcd3/etcd/etcd --config-file=/usr/local/etcd3/etcd.conf

查看etcd 状态

(随便一个客户端都可以)
 /usr/local/etcd1/etcd/etcdctl --endpoints=http://127.0.0.1:12379,http://127.0.0.1:22379,http://127.0.0.1:32379 endpoint status --write-out=table
 
+------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|        ENDPOINT        |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| http://127.0.0.1:12379 | 8211f1d0f64f3269 |   3.5.4 |   20 kB |      true |      false |         8 |         52 |                 52 |        |
| http://127.0.0.1:22379 | 91bc3c398fb3c146 |   3.5.4 |   20 kB |     false |      false |         8 |         52 |                 52 |        |
| http://127.0.0.1:32379 | fd422379fda50e48 |   3.5.4 |   20 kB |     false |      false |         8 |         52 |                 52 |        |
+------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值