current position:Home>Docker tutorial on cloud computing core technology: docker swarm mode management adds nodes as management nodes

Docker tutorial on cloud computing core technology: docker swarm mode management adds nodes as management nodes

2021-09-01 02:32:24 TechWeb

When you first create a cluster , You will single Docker The engine is in cluster mode . Make full use of the group mode , You can add nodes to the group :

Adding work nodes will increase capacity . When you deploy services to swarm when , The engine schedules tasks on available nodes , Whether they are work nodes or management nodes . When you add staff to the cluster , You can increase the size of the cluster to handle tasks , Without affecting the manager raft Consensus .

Manager nodes improve fault tolerance . The manager node performs choreography and cluster management functions for the cluster . In the management node , A single leader node performs choreography tasks . If a leader node goes down , The remaining management nodes elect a new leader and restore the arrangement and maintenance of the cluster state . By default , The manager node also runs tasks .

Docker The engine is based on the... You provide to the command join-token Join in swarm docker swarm join. Nodes use tokens only when joining . If you then rotate tokens , Will not affect the existing swarm node .

Join as a management node

When you run docker swarm join And pass the manager token ,Docker The engine will switch to... Like a staff member swarm Pattern . The management node is also involved raft Consensus . The new node should be Reachable, But the existing manager is still a cluster Leader.

Docker It is recommended to have three or five manager nodes per cluster to achieve high availability . because swarm mode manager Node usage Raft Shared data , So there must be an odd number manager. As long as more than half of the management nodes are available , The group can continue to run .

More details about group manager and managing groups , see also Management and maintenance Docker Engine group .

To retrieve the join command containing the join token of the management node , Please run the following command on the management node :

$ docker swarm join-token manager

To add a manager to this swarm, run the following command:

docker swarm join \

--token SWMTKN-1-61ztec5kyafptydic6jfc1i33t37flcl4nuipzcusor96k7kby-5vy9t8u35tuqm7vh67lrz9xp6 \

Run the command in the output on the new manager node to join it to the group :

$ docker swarm join \

--token SWMTKN-1-61ztec5kyafptydic6jfc1i33t37flcl4nuipzcusor96k7kby-5vy9t8u35tuqm7vh67lrz9xp6 \

This node joined a swarm as a manager.

copyright notice
author[TechWeb],Please bring the original link to reprint, thank you.

Random recommended