昨天本来想部署一台测试的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 | |
+------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+