简体   繁体   English

如何在Docker Swarm中设置集群?

[英]How to set up a cluster in Docker Swarm?

I need to setup a cluster of nodes using Docker Swarm. 我需要使用Docker Swarm设置节点集群。 When I say a node, it should have a db, few apps/services and they need to commuicate with each other. 当我说一个节点时,它应该有一个数据库,很少的应用程序/服务,他们需要相互通信。 I can create a single instance of this using Docker Compose. 我可以使用Docker Compose创建一个这样的实例。

But, I need multiple instances of this setup. 但是,我需要这个设置的多个实例。 So, would Docker Swarm help? 那么,Docker Swarm会有帮助吗?

When I say a node, it should have a db, few apps/services and they need to commuicate with each other 当我说一个节点时,它应该有一个数据库,很少的应用程序/服务,他们需要相互通信

Docker Swarm is a tool for managing cluster of nodes, when node is a machine (VM/physical) with docker installed. 当节点是安装了docker的计算机(VM /物理)时,Docker Swarm是用于管理节点集群的工具。 it's not clear what you expect "node" to be, but with swarm you can run any number of containers which will be deployed across the different machines in the cluster. 目前尚不清楚您对“节点”的期望是什么,但是使用swarm,您可以运行任意数量的容器,这些容器将部署在群集中的不同计算机上。

But, I need multiple instances of this setup. 但是,我需要这个设置的多个实例。 So, would docker swarm help? 那么,docker swarm会有帮助吗?

You can define anything on the cluster, but basically swarm is meant to enable communication between the nodes. 您可以在群集上定义任何内容,但基本上swarm用于启用节点之间的通信。 if you want all your services (which you call "node") to be on the same machine anyway, so swarm will not give you any benefits. 如果您希望所有服务(您称之为“节点”)无论如何都在同一台机器上,那么swarm将不会给您带来任何好处。 just copy-paste the docker compose file between all your nodes. 只需在所有节点之间复制粘贴docker compose文件。 But this isn't something common/recommended in general so maybe if you'll explain better your needs, it would be easier to help you. 但这并不是常见的/一般推荐的,所以如果你能更好地解释你的需求,那么帮助你会更容易。

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

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