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 understand Swarm in Docker

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

How to understand Swarm in Docker, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Basic concepts of swarm

Swarm is decentralized and integrated into Docker Engine, managed through Docker CLI.

Swarm cluster consists of two types of nodes

Manager Node-responsible for scheduling Task (no more than 7 are recommended, there are two states: leader, reachable, cluster operation needs to be in the management node)

Worker Node-Task that accepts Manager Node scheduling and assignment

The availability for each swarm node includes:

Active: accept task

Pause: do not accept task, existing task is still running

Drain: task is not accepted. Task has been handed over.

Through the routing mesh policy (based on lvs), all nodes in the swarm cluster listen on the service port (nodes that do not start the service will automatically route traffic to the service resident node)

After the services in the cluster are opened to external ports, the node changes from preparing to running.

Multiple duplicate services can reside on a cluster node

Swarm transition

Docker1.6 introduces Swarm

Independent of Docker engine

Use Docker CLI

Docker 1.12 released Swarm Kit a few weeks ago

Use your own CLI (swarmd is responsible for management, swarmctl is for control)

Is the foundation of Swarm mode

Docker 1.12 released Swarm Mode (a fully functional container orchestration tool)

Integrated into Docker engine (docker slots subcommand)

Using Docker CLI, introduce the concept of service

Writing based on Swarmkit

Build swarm cluster # transfer to SwarmMode (the current machine is used as a cluster management node) docker swarm init-advertise-addr Manager node ip: Port # New tokendocker swarm join-token worker | manager# node join the cluster to become a working copy docker swarm join--token token Manager node ip: Port # View cluster node docker node ls# check specified node docker node inspect self | NODE# node status change docker node update-- availability drain manager# setting Setting Manager Node only has management function # Node tagged docker node update-- label-add key name = value # Node lifting / reducing weight docker node promote Node # upgraded to manager nodedocker node demote Node # downgraded to worker node# Node exit Cluster docker swarm node leave [--force] to build a cluster network

When a cluster is built, node communication defaults to port 2377.

The service discovery of the cluster load balancer network works on the port:

7946 TCP/UDP: service Discovery of Cluster

4789 UDP: routing network for cluster service

Docker network create-driver overlay Network name # create a network (the network is isolated and securely encrypted so that the same network node can access each other) docker network ls # list network docker network inspect network name # does it help you to read the above content after monitoring the network? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report