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 build docker Cluster by swarm

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "swarm how to build docker cluster", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "swarm how to build docker cluster" this article.

What is Swarm?

Swarm is a relatively simple tool released by Docker in early December 2014 to manage Docker clusters. It turns a group of Docker hosts into a single, virtual host. Swarm uses the standard Docker API interface as its front-end access entrance, in other words, various forms of Docker Client (docker client in go, docker_py, docker, etc.) can communicate directly with Swarm. Swarm is almost entirely developed in the GE language. Last Friday, April 17, Swarm0.2 was released. Compared to version 0.1, version 0.2 adds a new policy to schedule containers in the cluster to propagate them on available nodes, as well as support more Docker commands and cluster drivers.

Swarm deamon is just a Scheduler and router. Swarm does not run the container itself, it just accepts requests from docker clients and schedules suitable nodes to run the container, which means that even if Swarm dies for some reason, the nodes in the cluster will run as usual, and when Swarm resumes operation, it will collect and rebuild cluster information. The following is the structure diagram of Swarm:

What can I do?

Set up a dockers cluster

How to play?

Install env: a, B, and C, A will be the management machine, centos system, root users, each machine executes: sudo docker pull swarm

Modify the docker configuration file sudo vi / etc/sysconfig/docker to add the following DOCKER_OPTS= "- H 0.0.0.0 etc/sysconfig/docker 2375-H unix:///var/run/docker.sock" at the end of the file

Restart dockers sudo service docker restart

Use tokens to discover

Using DOCKHUB to build any one, execute the following command sudo docker run-- rm swarm create where a token will be generated, assuming 1111

Swarm join command to add machines to the cluster. A sudo docker run B Magee C: sudo docker run-d swarm join-addr=A:2375 token://1111

Swarm manager A: sudo docker run-d-p 2376pur2375 swarm manage token://1111

The first step is to run swarm as daemon

Second, port mapping: 2376 can be replaced with any port that is not occupied by this machine, and it must not be 2375, otherwise there will be problems.

Swarm list Arecrome brecinca Crane docker run-- rm swarm list token://1111

These are all the contents of the article "how to build docker clusters in swarm". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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