简体   繁体   English

Swarm Master应该作为单节点群集中的节点加入吗?

[英]Should Swarm Master Join As Node in a Single Node Cluster?

We are building a small cluster, and a (strange) requirement is to setup everything in one machine, to which other machines can join in the future. 我们正在构建一个小型集群,(奇怪的)要求是在一台机器上设置所有内容,将来其他机器可以加入。

I set up consul with: 我设立领事:

docker run -d -p 8500:8500 --name=consul progrium/consul -server -bootstrap

and the master with: 和大师一起:

docker run -d -p 4000:4000 swarm manage -H :4000 --advertise <ip_here>:4000 consul://<ip_here>:8500

where docker is run with: 在其中运行docker的位置:

sudo docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock

and docker -H :4000 info lists the Nodes as 0 at this stage, where I cannot run any images with docker -H :4000 run <image> because No healthy node available in the cluster. docker -H :4000 info在此阶段将节点列为0,在这里我无法使用docker -H :4000 run <image>运行任何映像,因为No healthy node available in the cluster.

When I join the master node to the cluster with: 当我通过以下方式将主节点加入集群时:

docker run -d swarm join --advertise=<ip_here>:2375 consul://<ip_here>:8500

Then docker -H :4000 info lists the Nodes as 1, and I can run containers. 然后docker -H :4000 info将节点列为1,我可以运行容器。

Please note that <ip_here> refers all to the same ip of the machine. 请注意, <ip_here>指机器的相同IP。

Is this the intended behaviour? 这是预期的行为吗? If not, what am I doing wrong? 如果没有,我在做什么错?

After seeing Docker Machine's way of creating a Swarm cluster, as well as using Swarm that is integrated into Docker v1.12.0, I wanted to post an update. 在了解了Docker Machine创建Swarm集群的方式以及使用集成到Docker v1.12.0中的Swarm之后,我想发布一个更新。 Swarm master does join Swarm cluster, by running two containers, an agent and a master. Swarm主机通过运行两个容器,一个代理和一个主机来加入Swarm集群。

As for me, I use the Swarm Master as the Consul server. 对于我来说,我使用Swarm Master作为Consul服务器。 This answer may help you. 这个答案可能会帮助您。 Then, to answer, the Swarm Master does not join in as a single node cluster. 然后,要回答,Swarm Master不会作为单个节点群集加入。

You can't deploy Swarm on a single node. 您无法在单个节点上部署Swarm。 That's not its use and cannot work that way. 那不是它的用途,不能那样工作。 Swarm turns a pool of Docker hosts into a single, virtual Docker host , so if the pool of Docker hosts contains zero hosts... There is no Docker Agent to host container. Swarm 将Docker主机池转换为单个虚拟Docker主机 ,因此,如果Docker主机池包含零个主机...没有托管容器的Docker Agent。

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

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