简体   繁体   English

如何使用领事初始化Docker群

[英]How to init docker swarm with consul

How do I start a docker swarm cluster with consul back-end? 如何使用领事后端启动docker swarm集群?

I can't see any discovery param in the docker swarm init command? 我在docker swarm init命令中看不到任何发现参数吗? or the docker swarm join command? 或docker swarm join命令? I successfully ran 我成功跑了

docker swarm init .... docker swarm初始化....

and than 然后

docker swarm join docker swarm加入

to start a cluster on the internal swarm discovery mechanism, but it's not recommended for production. 在内部群发现机制上启动集群,但是不建议在生产环境中使用它。 So what am I missing? 那我想念什么呢?

You are running the newer Swarm Mode commands but asking about the usage of the classic Swarm that runs as a container, these are two very different things. 您正在运行较新的Swarm Mode命令,但询问作为容器运行的经典Swarm的用法,这是两件截然不同的事情。

Swarm Mode uses a raft implementation for the manager state that is not swappable with an external key/value store. Swarm模式将木筏实现用于无法与外部键/值存储交换的管理器状态。 You run swarm mode with the commands you listed ( docker swarm init and docker swarm join ). 您使用列出的命令( docker swarm initdocker swarm join )运行swarm模式。 The join command eliminates the need for an external node discovery database. join命令消除了对外部节点发现数据库的需要。 https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/ https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/

Classic swarm used an external node discovery, the default using a docker hub token that was not recommended for production. 经典群使用外部节点发现,默认情况下使用不建议用于生产的Docker集线器令牌。 To implement classic Swarm you run the docker run swarm manage with the options to publish the port to access the manager and option to discover the nodes in the swarm. 要实施经典Swarm,您可以运行docker run swarm manage并使用选项发布端口以访问管理器,并选择发现swarm中的节点的选项。 Classic Swarm has more in common with a reverse proxy to the docker api than an orchestration tool like Swarm Mode or Kubernetes. 与Swarm Mode或Kubernetes等编排工具相比,Classic Swarm与docker api的反向代理有更多的共同点。 https://docs.docker.com/swarm/reference/manage/ https://docs.docker.com/swarm/reference/manage/

So the answer to your question is to either not use Swarm Mode commands and instead run the classic Swarm containers, or if you want Swarm Mode, to not try to implement your own external node discovery database because that's not an option. 因此,问题的答案是要么不使用Swarm Mode命令,而是运行经典的Swarm容器,要么如果您想要Swarm Mode,则不要尝试实现自己的外部节点发现数据库,因为这不是一个选择。 I'd recommend the latter unless you have a specific need for classic Swarm. 我建议使用后者,除非您对经典Swarm有特定的需求。

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

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