如何使用领事初始化Docker群 [英] How to init docker swarm with consul

查看:67
本文介绍了如何使用领事初始化Docker群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过领事后端启动docker swarm集群?

How do I start a docker swarm cluster with consul back-end?

我在docker swarm init命令中看不到任何发现参数吗?或docker swarm join命令?我成功运行了

I can't see any discovery param in the docker swarm init command? or the docker swarm join command? I successfully ran


docker swarm init ....

docker swarm init ....

并且比


docker swarm join

docker swarm join

在内部群发现机制上启动集群,但是不建议在生产环境中使用它。那我想念什么?

to start a cluster on the internal swarm discovery mechanism, but it's not recommended for production. So what am I missing?

推荐答案

您正在运行更新的Swarm Mode命令,但询问运行的经典Swarm的用法作为容器,这是两个非常不同的事物。

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模式对不能通过外部键/值存储交换的管理器状态使用筏式实现。您使用列出的命令( docker swarm init docker swarm join )运行swarm模式。 join命令消除了对外部节点发现数据库的需要。 https://docs.docker.com/engine/swarm / how-swarm-mode-works / nodes /

Swarm Mode uses a raft implementation for the manager state that is not swappable with an external key/value store. You run swarm mode with the commands you listed (docker swarm init and docker swarm join). The join command eliminates the need for an external node discovery database. https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/

Classic swarm使用外部节点发现,默认情况下使用不建议用于的docker hub令牌生产。要实现经典的Swarm,您可以运行 docker run swarm manage ,其中包含发布用于访问管理器的端口的选项以及用于发现swarm中的节点的选项。与Swarm Mode或Kubernetes之类的编排工具相比,Classic Swarm与docker api的反向代理有更多的共同点。 https://docs.docker.com/swarm/reference/manage/

Classic swarm used an external node discovery, the default using a docker hub token that was not recommended for production. 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. Classic Swarm has more in common with a reverse proxy to the docker api than an orchestration tool like Swarm Mode or Kubernetes. https://docs.docker.com/swarm/reference/manage/

因此,您的问题的答案是要么不使用Swarm Mode命令,而是运行经典的Swarm容器,要么如果您想要Swarm Mode,则不要尝试实现自己的外部节点发现数据库,因为这不是一个选择。除非您特别需要经典Swarm,否则我建议您使用后者。

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. I'd recommend the latter unless you have a specific need for classic Swarm.

这篇关于如何使用领事初始化Docker群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆