Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to understand replicated mode and global mode

Shulou Source: shulou.com Published: 2022-06-01 00:53:23 09月22日 Update

This article will explain in detail how to understand replicated mode and global mode. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Swarm can flexibly adjust the number of container replicas through-replicas during the creation or operation of service, and the internal scheduler will start and stop containers on different node according to the resource usage of the current cluster, which is the default replicated mode of service. In this mode, there are more and less copies running on the node, and in general, the more resourced node runs more copies, and vice versa.

In addition to replicated mode,service, a globalmode is provided to force one and up to one copy to run on each node.

This mode is particularly suitable for cluster environments that need to run daemon. For example, to collect logs from all containers, you can global mode to create a service, run the gliderlabs/logspout container on all node, and even if a new node is added later, swarm will automatically start a copy of gliderlabs/logspout on the new node.

Docker service create\

-- mode global\

-- name logspout\

-- mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock\

Gliderlabs/logspout

You can view the mode of service through docker service inspect.

Here is Global. If you don't specify it when you create a service, the default is Replicated.

Whether using global mode or replicated mode, which node the replica runs on is determined by Swarm. As users, is it possible for us to finely control the running location of service?

On how to understand replicated mode and global mode to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Run copy container more content article pattern knowledge article resource cluster different good location function and vice versa can be passed that is situation quantity Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn Docker Redmi Microsoft