如何确保服务“全局”在所有节点上运行?

时间:2018-08-21 15:53:51

标签: docker docker-swarm

我有一个3个节点的SWARM集群(1个主节点+ 2个工作线程),在这个集群上,许多服务正在运行,其中两个处于“全局”模式。

一旦我添加了第三个工作程序,两个全局服务中只有一个在新节点上(3/3-> 4/4),而另一个不在实例化上。

节点与服务控制:

>>>> SERVICES

ID                  NAME                            MODE                REPLICAS            IMAGE                                                                                       PORTS
myrvhr2h2rmj        cfgserver_v1                    global              3/3                 ...
5si0q4vr7931        ...
3w7bkgnxrsc4        ...
fwjm5wpm43z7        ...
rmcwwnm974ge        ...
07jnp70ne910        ...
fl0libz892vg        ...
mv7w95au0ygo        ...
v486vdmdqxk2        ...
u6eogvohitlu        ...
2gbtb90okg87        ...
snayj3ue5xw6        ...
pobcb8v4ueco        ...
7axyhn7buubc        ...
5iuy9fe4xxeb        portainer                       replicated          1/1                 portainer/portainer:latest                                                                  *:9000->9000/tcp
uzfwfy0a65zp        portainer_agent                 global              4/4                 portainer/agent:latest

>>>> SERVICES INSTANCES


>>>> Docker processes inventory [ip-10-200-2-11.eu-west-1.compute.internal]

CONTAINER ID        IMAGE                                                                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
559986e222a6        portainer/agent:latest                                                 "./agent"                2 hours ago         Up 2 hours                                   portainer_agent.cef0kxvuzhgv6jz1ixddnhevu.h3yp2w4m96atxag68kfrywcbr
6dcb02fd4924        ...
6871fcd2448c        portainer/portainer:latest                                             "/portainer -H tcp:/…"   2 hours ago         Up 2 hours          9000/tcp                 portainer.1.ujdzs4osc3jf02cl7tjwwk8ra
56eb5bc29240        redis                                                                  "docker-entrypoint.s…"   27 hours ago        Up 27 hours         0.0.0.0:6379->6379/tcp   ...
Connection to 10.200.2.11 closed.

>>>> Docker processes inventory [ip-10-200-2-103.eu-west-1.compute.internal]

CONTAINER ID        IMAGE                                                                                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
475b99c75704        ...
cffb7ec5086b        ...
c9dc320a853e        ...
c68e7f4b3f4d        ...
910d0a58c540        ...
640a6597ba2b        portainer/agent:latest                                                                      "./agent"                2 hours ago         Up 2 hours                                   portainer_agent.ajmrtnqhc36nlf1xria4eibn2.uh6fobu3thfqf6xh1yg49xkm7
Connection to 10.200.2.103 closed.

>>>> Docker processes inventory [ip-10-200-4-30.eu-west-1.compute.internal]

CONTAINER ID        IMAGE                    COMMAND             CREATED             STATUS              PORTS               NAMES
d7c66a605832        portainer/agent:latest   "./agent"           24 minutes ago      Up 24 minutes                           portainer_agent.x0enk45g5wycku002e5bdc197.mlry00o4quz0nv19qujb88ieh
Connection to 10.200.4.30 closed.

>>>> Docker processes inventory [ip-10-200-6-72.eu-west-1.compute.internal]

CONTAINER ID        IMAGE                                                                                    COMMAND                  CREATED             STATUS              PORTS                    NAMES
b4cd9c7b4a96        ...
e54287b8db95        ...
de74052913e4        ...
1854c3920a7a        ...
89dec36b698b        ...
cc08ea2d635c        ...
8e3d6318d7ae        ...
f4e4fc925f16        ...
f13bce549642        portainer/agent:latest                                                                   "./agent"                39 minutes ago      Up 39 minutes                                portainer_agent.ro0exu9xbxm260lq07ryrvnej.mtsick0zwsqbwrxj1mnvl4aer
Connection to 10.200.6.72 closed.

我们肯定会看到[cfgserver_v1]服务是[global],但从未在[10.200.4.30]上实例化。

有人有主意吗?

1 个答案:

答案 0 :(得分:0)

感谢你们,事实上[docker service ps cfgserver_v1]向我展示了无法实例化该容器:

Shutdown            Rejected about an hour ago   "No such image: ..."

我在使用AWS,最后只是一个基本的AWS docker Registry访问问题:)