In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use docker-swarm cluster commands". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to use docker-swarm cluster commands".
Docker Swarm is one of the official projects of Docker. It provides docker container cluster service, which is the core solution of Docker official support for container cloud ecological image. It is the official container cluster platform launched by Docker and is implemented based on GE language.
Docker Swarm is a tool that natively supports docker cluster management. It can transform a system composed of multiple Docker hosts into a single virtual Docker host, so that containers can form a subnet network across hosts.
Deploy Docker on many machines to form a Docker cluster, and abstract the resources of the entire cluster into resource pools. When users deploy Docker applications, they only need to hand over the applications to Swarm,Swarm to allocate resources to the deployed Docker applications according to the utilization of the resources of the entire cluster, which can maximize the resource utilization of this cluster.
Use Docker CLI to create clusters, deploy application services to the cluster, and manage group behavior. Its main purpose is to better help users manage multiple Docker Engine, make it easy for users to use, and use container cluster services like Docker Engine.
1. Create a Docker Swarm cluster
Create a Docker Swarm cluster on the Docker machine named Docker manager1 with the following instructions.
Sudo docker swarm init-- advertise-addr 192.168.197.143
On the management node, use the docker node ls directive to view the cluster node information
Sudo docker node ls
2. Add work nodes to the Docker Swarm cluster
Start the other two Docker machines worker1 and worker2, open the terminal window respectively, and execute the instructions to add work nodes to the cluster. The specific operation instructions are as follows.
Sudo docker swarm join-- token SWMTKN-1-2l5ldta6kir8ybimpfhzf32t3vnu2m7gl7u70zrdarzq7f8461-9t4v8i43jrh8pgvlorxviwabw 192.168.197.143VR 2377
Once again, use the docker node ls instruction on the cluster management node to view the cluster node information
Sudo docker node ls
3. Deploy services to the Docker Swarm cluster
When deploying a service to a Docker Swarm cluster, you can start the service either by using the image that comes with the Docker Hub or by using your own image through Dockerfile. If you use the image built by yourself through Dockerfile to start the service, you must first push the image to the Docker Hub central warehouse.
To facilitate learning, here we use the alpine image that comes with Docker Hub as an example to deploy the cluster service. The specific instructions are as follows:
Sudo docker service create-replicas 1-name helloworld alpine ping docker.com
4. View the services in the Docker Swarm cluster
When the service is deployed, you can view the service list information in the current cluster through the docker service ls instruction on the management node.
Sudo docker service ls
You can use the docker service inspect instruction to view the details of the deployed service. The specific operation instructions are as follows.
Sudo docker service inspect helloworld
You can use the docker service ps instruction to view the allocation and operation of the specified service on the cluster node, as shown below.
Sudo docker service ps helloworld
The above is all the contents of the article "how to use docker-swarm Cluster commands". 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.
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.