【发布时间】:2017-12-13 09:36:26
【问题描述】:
帮助理解 consul 节点和 consul 代理的启动。
我有一台虚拟机,上面有consul + vault + 2 consul nodes。在VM 3 ip LAN。
所有这些都在 docker 容器中。当我尝试从另一个虚拟机连接到这个领事时。然后代理连接到第一个控制台,无法连接到领事的其他节点。
据我了解,我需要在单独的 ip 主机虚拟机上运行所有 3 个控制台节点,这样才能访问它们的领事代理。只是如何做到这一点?
我用这个 docker-compose 开始 consul + vault:
version: "2"
services:
consul1:
image: "consul.1.0.1"
container_name: "consul12"
hostname: "consul12"
volumes:
- ./consul/config:/config/
ports:
- "8400:8400"
- "8500:8500"
- "8600:53"
- "8300:8300"
- "8301:8301"
command: "agent -config-dir=/config -ui -server -bootstrap-expect 3"
consul2:
image: "consul.1.0.1"
container_name: "consul2"do
hostname: "consul2"
volumes:
- ./consul/config:/config/
expose:
- "8400"
- "8500"
- "8600"
- "8300"
- "8301"
command: "agent -config-dir=/config -server -join consul1"
depends_on:
- consul1
consul3:
image: "consul.1.0.1"
container_name: "consul3"
hostname: "consul3"
volumes:
- ./consul/config:/config/
expose:
- "8400"
- "8500"
- "8600"
- "8300"
command: "agent -config-dir=/config -server -join consul1"
depends_on:
- consul1
vault:
depends_on:
- consul1
image: "vault"
hostname: "vault"
links:
- "consul1:consul1"
environment:
VAULT_ADDR: http://127.0.0.1:8200
ports:
- "8200:8200"
volumes:
- ./vault/tools/wait-for-it.sh:/wait-for-it.sh
- ./vault/config/vault:/config
- ./vault/config/vault/policies:/policies
entrypoint: /wait-for-it.sh -t 20 -h consul1 -p 8500 -s -- vault server -config=/config/with-consul.hcl
和领事设置:
{
"data_dir": "/data",
"client_addr": "0.0.0.0",
"ports": {
"dns": 53
},
"disable_update_check": true,
"addresses": {
"https": "0.0.0.0"
}
}
【问题讨论】:
-
对不起,但其他领事是主人?或者这些其他领事是代理人?
标签: docker networking docker-compose consul