consul 集群配置

1. consul 下载安装(略)

2. 关闭当前运行consul(若没有consul运行,则跳过此步):

netstat -anp | grep consul

 

 

tcp       0      0 192.168.137.189:8300   0.0.0.0:*              LISTEN      1224/consul

tcp       0      0 192.168.137.189:8301   0.0.0.0:*              LISTEN      1224/consul

tcp       0      0192.168.137.189:8302   0.0.0.0:*              LISTEN      1224/consul

tcp       0      0127.0.0.1:8400         0.0.0.0:*              LISTEN      1224/consul

tcp       0      0127.0.0.1:8500         0.0.0.0:*              LISTEN      1224/consul

tcp       0      0127.0.0.1:34258        127.0.0.1:8500         ESTABLISHED 6460/consul-templat

tcp       0      0 127.0.0.1:34228        127.0.0.1:8500         ESTABLISHED 6460/consul-templat

tcp       0      0127.0.0.1:34244        127.0.0.1:8500         ESTABLISHED 6460/consul-templat

tcp       0      0127.0.0.1:34226        127.0.0.1:8500         ESTABLISHED 6460/consul-templat

.

.

.

.

 

kill -s 9 1224

 

3. 绑定eth0,并启动consul

consul agent -server -bootstrap -bind=192.168.4.86  -data-dir=/etc/node4 -node=node4 -dc=dc4

 

(如果正在建立第一个服务器,跳过第四步)

4. 在服务器1192.168.4.229)中添加服务器4,如下:

consul join -wan 192.168.4. 86

 

5. 依次在四个服务器中修改,结果如下:

consul members -wan

 

 

Node      Address            Status  Type    Build  Protocol  DC

node1.dc1 192.168.4.229:8302  alive   server  0.7.5  2        dc1

node2.dc2 192.168.4.152:8302  alive   server  0.7.5  2        dc2

node3.dc3 192.168.4.151:8302  alive   server  0.7.5  2        dc3

node4.dc4 192.168.4.86:8302   alive   server  0.7.5  2        dc4

 

你可能感兴趣的:(consul)