Skip to content

Instantly share code, notes, and snippets.

@zii
Last active March 4, 2019 00:43
Show Gist options
  • Save zii/b03dcad76eb64514ccf2004a66c02b1d to your computer and use it in GitHub Desktop.
Save zii/b03dcad76eb64514ccf2004a66c02b1d to your computer and use it in GitHub Desktop.
etcd3
[etcd配置2个节点的集群]
访问 https://discovery.etcd.io/new?size=2
获取集群服务发现地址
https://discovery.etcd.io/7733391c8a003249b7457af826b10490
启动node1
etcd --name infra0 --initial-advertise-peer-urls https://192.168.3.60:3380 \
--listen-peer-urls https://0.0.0.0:3380 \
--listen-client-urls http://0.0.0.0:3379 \
--advertise-client-urls http://192.168.3.60:3379 \
--discovery https://discovery.etcd.io/7733391c8a003249b7457af826b10490 \
--initial-cluster-state new \
--peer-auto-tls
启动node2
etcd --name infra1 --initial-advertise-peer-urls https://192.168.3.60:3480 \
--listen-peer-urls https://0.0.0.0:3480 \
--listen-client-urls http://0.0.0.0:3479 \
--advertise-client-urls http://192.168.3.60:3479 \
--discovery https://discovery.etcd.io/7733391c8a003249b7457af826b10490 \
--initial-cluster-state new \
--peer-auto-tls
用客户端测试:
etcdctl --endpoints=127.0.0.1:3379 put x 1
OK
etcdctl --endpoints=127.0.0.1:3479 get x
x
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment