Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use docker swarm

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to use docker swarm". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Overview

Docker swarm is a tool for creating clusters of Docker hosts (servers running Docker daemons). It is a native cluster management tool for docker. Using Swarm to operate a cluster makes users feel as if they are operating on a host. It uses standard docker API, which means that other tools that use Docker API, such as compose, can also use swarm. # # basic Architecture the basic architecture of swarm is very simple. It is only an allocator and scheduler, and is generally divided into four structures:

The first is the file mode.

Every two is the node mode.

The third is token mode.

The fourth is discovery mode.

* * Note: * * neither of the first two modes requires any agent software to be installed on the docker host. You only need to specify the docker host and port number in the swarm management machine. In discovery mode, you need to run a swarm agent (that is, swarm join) and a host to run the swarm manager (that is, swarm manage) on each host.

Experiment

In this experiment, in order to simplify the complexity and to have an intuitive understanding of swarm quickly, we adopt the node mode of swarm.

* * Machine allocation * *

IP- role

192.168.0.201 Docker host

192.168.0.202 Docker host

192.168.0.203 Swarm management machine

* * first step * *

Change the listening mode on all docker hosts to port listening mode, and you can add the following configuration to the configuration file:

DOCKER_OPTS= "- H tcp://0.0.0.0:2375"

Restart docker.

* * step 2 * *

I did not use the container in the official way, but compiled and installed it from the source code downloaded from GITHUB, which means that there is no docker running environment on the 192.168.0.203 host, and it is purely an application server. Start swarm management on the swarm management machine with the following command:

Swarm manage nodes://192.168.0.201:2375192.168.0.202:2375-H 192.168.0.203 purl 2375

In this way, the whole swarm cluster has been set up. When accessing, you only need to execute the following command on any client that has docker installed:

Docker-H 192.168.0.203 docker 2375 info

You can see the status of the cluster.

That's all for the content of "how to use docker swarm". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report