In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what Swarm mode is in docker. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
In general, we deploy containers under one machine, but in practice, applications that cannot meet our needs on one machine contain more containers. Therefore, deploying our applications in a production environment will involve a lot of containers, which will bring us a series of problems:
How to manage so many containers?
How can it be easily scaled out?
If the container is down, how can it be automatically restored?
How to update the container without affecting the business?
How to monitor and track these containers?
How to schedule the creation of containers?
Protect private data?
In this way, we need container orchestration technology, and Swarm Mode came into being.
Swarm is not the only tool that can do container orchestration, but Swarm is a tool built into docker. So we don't need to install anything when we use Swarm, Swarm is already built into our system, but we don't run in Swarm mode, we usually run in stand-alone mode. So swarm is the first tool for beginners to come into contact with container choreography.
Swarm architecture
Swarm is a kind of cluster architecture, since it is a cluster, there must be nodes, and if there are nodes, then there must be roles. There are two roles for node node in Swarm. The first role is called Manager, and the second role is called worker.
Manager nodes are like the brains of a cluster. in a production environment, in order to avoid a single point of failure, there must be at least two "brains", so there will be state synchronization, that is, how the data generated by one Manager is synchronized to another Manager node. Here it involves a built-in distributed storage database, which synchronizes the data through the raft protocol. Raft protocol can ensure that the information of Manager nodes is symmetrical and synchronous, and can avoid brain fissure.
The Worker node is the node that actually works. The real container deployed in cluster will run in the Work node. Of course, the Manager node can also run, but it generally runs in the Worker node because there are more Worker nodes. There is also data synchronization between Worker nodes, which is done through Gossip network.
A very important concept in Swarm is Service and Replicas.
Service introduced docker compose in the previous section. The meaning of service in Swarm is basically the same as that of service under docker compose. A service represents a container.
In Replicas mode, that is, when we want to scale out and redeploy, a replicas is a container.
As shown in the figure above, we want to deploy a service of Nginx and give it three extensions. In fact, three containers will be generated in the process of deployment, and these three containers will be dispatched to different node through the scheduling system. In other words, we deploy a service through the Swarm Manager node, but we do not know which node the service will eventually run on. This time, it is calculated according to the schedule of Swarm according to a certain scheduling algorithm, for example, the algorithm will be selected according to the load of the node.
The figure above is a process of scheduling by swarm algorithm. Make some decisions on swarm manager to decide which service to deploy on which node, and then perform an actual operation.
So much for sharing what Swarm mode is in docker. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.