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--
What this article shares with you is about how docker is released in a cluster. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
How to release docker in a cluster?
We can use Swarm to create a native cluster of docker containers. Docker Swarm is a native cluster project for Docker that converts a pool of Docker hosts into a single virtual host.
Swarm works with standard Docker API, so any tool that can communicate with the Docker daemon can use Swarm to scale transparently to multiple hosts.
1. Prerequisites for running Swarm
We must install Docker 1.4.0 or later on all nodes. Although the IP address of each node does not need to be a public address, the Swarm manager must be able to access each node over the network. Note: Swarm is currently in the beta version, so features and other features may change, and you are not recommended to use it in a production environment.
two。 Create a Swarm cluster
Now we will create the Swarm cluster by running the following command. Each node will run a swarm node agent that registers, monitors the relevant Docker daemons, and updates the node status acquired by the discovery back end. The following command returns a unique cluster ID tag that is used when starting the Swarm agent on the node.
Run on the cluster manager:
# docker run swarm create
3. Start the Docker daemon on each node
We need to log in to each node that will be used to create the cluster and start the Docker daemon with the-H flag on it. It ensures that the Swarm manager can access the Docker remote API on each node through TCP. To start the Docker daemon, you need to run the following command inside each node.
# docker-H tcp://0.0.0.0:2375-d
4. Add nod
After enabling the Docker daemon, we need to add the Swarm node to the discovery service, and we must ensure that the node IP is accessible from the Swarm manager. To do this, you need to run the following command on each node.
# docker run-d swarm join-- addr=:2375 token://
Note: we need to replace the and here with the node IP address and cluster ID obtained in step 2.
5. Open the Swarm Manager
Now that we have the nodes connected to the cluster, we will start the swarm manager. We need to run the following command in the cluster manager.
# docker run-d-p: 2375 swarm manage token://
6. Check configuration
Once the administration is running, we can check the configuration by running the following command.
# docker-H tcp:// info
Note: we need to replace it with the IP address and port of the host running swarm Manager.
7. Use docker CLI to access nodes
This part is the most important part of Docker Swarm. We can use Docker CLI to access the node and run the container on the node.
# docker-H tcp:// info# docker-H tcp:// run...
8. Listen to nodes in a cluster
We can use the swarm list command to get a list of all the running nodes.
# docker run-rm swarm list token://
Swarm is really a docker with pretty good functionality that can be used to create and manage clusters. It's fairly easy to configure and use, and it's even better when we use limiters and analogs on it.
This is how docker carries on the cluster release, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.