确保 2379 和 2380 端口被打开,默认情况下
- 2379 用来监听客户端请求
- 2380 用来进行节点间通讯
Tip: CentOS Linux 7 中使用的 firewalld 来管理防火墙设置
Note: 其它节点也要确保这两个端口是开放的,否则无法正常工作
配置启动集群
代码语言:javascript复制[root@docker etcd-v2.2.4-linux-amd64]# ./etcd -name docker -initial-advertise-peer-urls http://192.168.100.103:2380
> -listen-peer-urls http://192.168.100.103:2380
> -listen-client-urls http://192.168.100.103:2379,http://127.0.0.1:2379
> -advertise-client-urls http://192.168.100.103:2379
> -initial-cluster-token etcd-cluster-test
> -initial-cluster docker=http://192.168.100.103:2380,h102=http://192.168.100.102:2380,h104=http://192.168.100.104:2380
> -initial-cluster-state new
2016-02-16 15:35:49.278204 I | etcdmain: etcd Version: 2.2.4
2016-02-16 15:35:49.278496 I | etcdmain: Git SHA: bdee27b
2016-02-16 15:35:49.278504 I | etcdmain: Go Version: go1.5.3
2016-02-16 15:35:49.278510 I | etcdmain: Go OS/Arch: linux/amd64
...
...
...
----------
[root@h104 etcd-v2.2.4-linux-amd64]# ./etcd -name h104 -initial-advertise-peer-urls http://192.168.100.104:2380
> -listen-peer-urls http://192.168.100.104:2380
> -listen-client-urls http://192.168.100.104:2379,http://127.0.0.1:2379
> -advertise-client-urls http://192.168.100.104:2379
> -initial-cluster-token etcd-cluster-test
> -initial-cluster docker=http://192.168.100.103:2380,h102=http://192.168.100.102:2380,h104=http://192.168.100.104:2380
> -initial-cluster-state new
2016-02-16 15:36:13.898374 I | etcdmain: etcd Version: 2.2.4
2016-02-16 15:36:13.898513 I | etcdmain: Git SHA: bdee27b
2016-02-16 15:36:13.898522 I | etcdmain: Go Version: go1.5.3
2016-02-16 15:36:13.898530 I | etcdmain: Go OS/Arch: linux/amd64
...
...
...
----------
[root@h102 etcd-v2.2.4-linux-amd64]# ./etcd -name h102 -initial-advertise-peer-urls http://192.168.100.102:2380 -listen-peer-urls http://192.168.100.102:2380 -listen-client-urls http://192.168.100.102:2379,http://127.0.0.1:2379 -advertise-client-urls http://192.168.100.102:2379 -initial-cluster-token etcd-cluster-test -initial-cluster docker=http://192.168.100.103:2380,h102=http://192.168.100.102:2380,h104=http://192.168.100.104:2380 -initial-cluster-state new
2016-02-16 15:37:38.592028 I | etcdmain: etcd Version: 2.2.4
2016-02-16 15:37:38.592139 I | etcdmain: Git SHA: bdee27b
2016-02-16 15:37:38.592155 I | etcdmain: Go Version: go1.5.3
2016-02-16 15:37:38.592163 I | etcdmain: Go OS/Arch: linux/amd64
...
...
...