我正试图让 Consul 在 Rancher 上运行。这似乎应该是一件容易的事,因为它已经有一个目录项。
然而,我们没有让它工作,它在启动时抛出一个异常,说 server.json 中的 json 无效。(这个 server.json 的位置或它的用途对我们来说仍然是一个谜)
因此,我尝试手动启动并运行它。有一些 docker-compose 脚本,它们都不能在 Rancher 中工作。
我尝试手动设置每个服务器,但仍然失败,每个节点都抱怨它没有从其他节点得到任何 ping。
这是我正在尝试构建的 docker-compose 文件: https ://github.com/AsynkronIT/ConsulCluster/blob/master/docker-compose.yml
consul1:
ports:
- 8400:8400/tcp
- 8500:8500/tcp
- 8600:8600/tcp
- 8301:8301/tcp
- 8301:8301/udp
- 8302:8302/tcp
- 8302:8302/udp
environment:
CONSUL_LOCAL_CONFIG: '{"skip_leave_on_interrupt": true}'
labels:
io.rancher.container.pull_image: always
tty: true
command:
- agent
- -server
- -bootstrap-expect=3
- -ui
hostname: consulserver1
image: consul:latest
stdin_open: true
consul2:
ports:
- 8400:8400/tcp
- 8500:8500/tcp
- 8600:8600/tcp
- 8301:8301/tcp
- 8301:8301/udp
- 8302:8302/tcp
- 8302:8302/udp
environment:
CONSUL_LOCAL_CONFIG: '{"skip_leave_on_interrupt": true}'
labels:
io.rancher.container.pull_image: always
tty: true
command:
- agent
- -server
- -bootstrap-expect=3
- -retry-join=consul1
hostname: consulserver2
image: consul:latest
stdin_open: true
links:
- consul1
consul3:
ports:
- 8400:8400/tcp
- 8500:8500/tcp
- 8600:8600/tcp
- 8301:8301/tcp
- 8301:8301/udp
- 8302:8302/tcp
- 8302:8302/udp
environment:
CONSUL_LOCAL_CONFIG: '{"skip_leave_on_interrupt": true}'
labels:
io.rancher.container.pull_image: always
tty: true
command:
- agent
- -server
- -bootstrap-expect=3
- -retry-join=consul1
hostname: consulserver3
image: consul:latest
stdin_open: true
links:
- consul1
我究竟做错了什么?还有其他人实际上设法让领事与 Rancher 合作吗?
这一点对我来说看起来超级奇怪:
memberlist: Suspect consulserver1 has failed, no acks received
memberlist: Got ping for unexpected node 'consulserver1' from=172.17.0.3:8301
memberlist: Got ping for unexpected node consulserver1 from=172.17.0.3:47164
memberlist: Failed TCP fallback ping: EOF
memberlist: Marking consulserver1 as failed, suspect timeout reached (0 peer confirmations)
日志说它没有从 consulserver1 得到任何确认,同时它抱怨意外节点 consulserver1 正在 ping 它。为什么?