简体   繁体   English

docker swarm-etcd群集不可用或配置错误

[英]docker swarm - etcd cluster is unavailable or misconfigured

I'm trying to get started with docker swarm using etcd for the discovery backend . 我正在尝试使用etcd作为发现后端使用docker swarm。 My etcd server is at etcd.programster.org (10.1.0.44) whilst my docker node is at swarm1.programster.org (10.1.0.47). 我的etcd服务器位于etcd.programster.org(10.1.0.44),而我的Docker节点位于swarm1.programster.org(10.1.0.47)。 All machines are running on Virtualbox instances on my local network (10.1.0.x). 所有计算机都在本地网络(10.1.0.x)的Virtualbox实例上运行。

I manage to get my etcd server running with the following: 我设法让我的etcd服务器运行以下命令:

MY_IP="10.1.0.44"

./etcd \
-name infra0 \
-initial-advertise-peer-urls http://$MY_IP:2380 \
-listen-peer-urls="http://0.0.0.0:2380,http://0.0.0.0:7001" \
-listen-client-urls="http://0.0.0.0:2379,http://0.0.0.0:4001" \
-advertise-client-urls="http://$MY_IP:2379" \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster infra0=http://$MY_IP:2380 \
-initial-cluster-state new

I can set and retrieve key values from swarm1.programster.org just fine with curl and etcd. 我可以使用curl和etcd从swarm1.programster.org设置和检索键值。

# setting key with etcdctl
./etcdctl --peers http://etcd.programster.org:4001 set etc://etcd.programster.org/mykey "test"

# setting key with curl
curl -L \
http://etcd.programster.org:4001/v2/keys/mykey \
-XPUT -d value="test"

# retrieving key with etcdctl
./etcdctl --peers http://etcd.programster.org:4001 get etc://etcd.programster.org/mykey

# retrieving key with curl
curl -L http://etcd.programster.org:4001/v2/keys/mykey

However, whenever I run a swarm based command such as: 但是,每当我运行基于群体的命令,例如:

docker run swarm list etcd://10.1.0.44/

or 要么

docker run swarm join --advertise=10.1.0.47:2375 etcd://10.1.0.44/

I always get the following error message: 我总是收到以下错误消息:

[timestamp] client: etcd cluster is unavailable or misconfigured

Have I configured my etcd server incorrectly or perhaps there is a networking configuration that I need to perform on the docker node first? 我的etcd服务器配置是否错误,或者是否需要首先在docker节点上执行网络配置? I have not performed any TLS authentication yet for simplicity but perhaps swarm will not work without this? 为了简单起见,我还没有执行任何TLS身份验证,但是如果没有此功能,可能无法群存?

Context 上下文

  • All machines are running Debian 8 (3.16.0-4-amd64). 所有机器都在运行Debian 8(3.16.0-4-amd64)。 Also tested with Ubuntu 14.04 for swarm1.programster.org. 还已在Ubuntu 14.04上对swarm1.programster.org进行了测试。
  • Docker version 1.9.1, build a34a1d5 Docker 1.9.1版,内部版本a34a1d5
  • etcd version 2.2.2 etcd版本2.2.2

Try including the port number like this: 尝试包括以下端口号:

docker run swarm join --advertise=10.1.0.47:2375 etcd://10.1.0.44:2379/swarm

I had the same issue and I assumed docker would intelligently infer the port number from "etcd://" - I was wrong. 我有同样的问题,我认为码头工人会智能地从“ etcd://”推断端口号-我错了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM