其中一台机器没问题,另一台再创建的时候出错了

来源:4-10 Docker Overlay网络和etcd实现多机容器通信

慕九州1544730

2018-09-12

####setup etcd cluster
在docker-node1上

#下载分布式工具
wget https://github.com/coreos/etcd/releases/download/v3.0.12/etcd-v3.0.12-linux-amd64.tar.gz
#解压
tar zxvf etcd-v3.0.12-linux-amd64.tar.gz
#进入解压文件内
cd etcd-v3.0.12-linux-amd64
#运行下面一大段指令,下面这段运行报错,代码应该是没有问题,应该是网络或者环境问题
nohup ./etcd --name docker-node1 --initial-advertise-peer-urls http://172.31.158.131:2380 \
--listen-peer-urls http://172.31.158.131:2380 \
--listen-client-urls http://172.31.158.131:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://172.31.158.131:2379 \
--initial-cluster-token etcd-cluster \
--initial-cluster docker-node1=http://172.31.158.131:2380,docker-node2=http://172.31.158.132:2380 \
--initial-cluster-state new&

在docker-node2上

#下载分布式工具
wget https://github.com/coreos/etcd/releases/download/v3.0.12/etcd-v3.0.12-linux-amd64.tar.gz
#解压
tar zxvf etcd-v3.0.12-linux-amd64.tar.gz
#进入解压文件内
cd etcd-v3.0.12-linux-amd64
#运行下面一大段指令
nohup ./etcd --name docker-node2 --initial-advertise-peer-urls http://172.31.158.132:2380 \
--listen-peer-urls http://172.31.158.132:2380 \
--listen-client-urls http://172.31.158.132:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://172.31.158.132:2379 \
--initial-cluster-token etcd-cluster \
--initial-cluster docker-node1=http://172.31.158.131:2380,docker-node2=http://172.31.158.132:2380 \
--initial-cluster-state new&

node2没有问题,但是node1
运行就会自动退出求解

写回答

1回答

慕九州1544730

提问者

2018-09-12

node1现在是这样

```

./etcdctl cluster-health

cluster may be unhealthy: failed to list members

Error:  client: etcd cluster is unavailable or misconfigured

error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused

error #1: dial tcp 127.0.0.1:2379: getsockopt: connection refused

```

node2是这样

```

./etcdctl cluster-health

failed to check the health of member ba28710e7d78116c on http://172.31.158.131:2379: Get http://172.31.158.131:2379/health: dial tcp 172.31.158.131:2379: getsockopt: connection refused

member ba28710e7d78116c is unreachable: [http://172.31.158.131:2379] are all unreachable

member e3cff630f79fce28 is unhealthy: got unhealthy result from http://172.31.158.132:2379

cluster is unhealthy

```

0
2
麦兜搞IT
回复
慕九州1544730
不知道是否是网络或者防火墙的问题
2018-09-14
共2条回复

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程