Swarm is used to build and manage docker clusters.

Source: Internet
Author: User
Tags docker swarm
1. Swarm is a scheduling framework developed by docker.
(Found on the Internet)

2.Server Load balancer: Docker is called ingress load balancing ). It works by listening to published service ports on all worker nodes. When the service is called by an external system, the node that receives the traffic will use the internal DNS service provided by docker to balance the traffic to different workers.

(Found on the Internet)

3.doc Ker cluster construction.

(1). Time Synchronization:
Yum install-y ntpdate
Ntpdate us.pool.ntp.org

(2) Start of the swarm Manager Service
Docker swarm init -- listen-ADDR 192.168.56.200: 2377

(3) If a node is added to the corresponding cluster, It is identified by tokens.
An error was reported when I added the port 2377.
Open the firewall port:
Firewall-cmd -- add-Port = 2377/tcp -- Permanent
Firewall-cmd -- reload

(42.16.doc Ker swarm join -- token SWMTKN-1-5uurnd5jjaxrsa6gt6s9chg35uuhm9f9cs7g0blmqdkw9lkpwf-3gcqoqcy0nom2i0q57un9fzcj 192.168.56.200: 2377
At this time, this machine has become a worker

To solve this problem, you must enable port 2377 on all Manager nodes to use the swarm function.

(5). You can also view the machine conditions in the cluster on the manager.
Docker node ls

4.doc Ker service creation

Service: A long-running docker container that can be deployed on any worker node, it can be connected and consumed by other containers in the remote system or swarm.

Task): The service runs on a container instance.

Replicas): The same service runs on a specified number of worker nodes.

Create a service
Docker service create -- name web_server httpd
Service with 2 replicas
Docker service create -- name web_server2-- Replicas 2Httpd
View service: docker service ls

View service task details: docker Service PS web_server2
There is a problem here: the two services that have just been created appear. In this case, the service is shut down, and the services created later are normal.

The service with 5 replicas is normal this time.
Docker service create -- name web_server3-- Replicas 5Httpd

If we want all nodes to run a service, we can use the global service. Global Service creates a service, which automatically runs tasks on each worker node.
Docker service create -- name web_server4-- Mode globalHttpd

Delete service:Docker service RMWeb_server

Service resizing
Docker ServiceScaleWeb_server5 = 2

Bind the service port in the cluster to the host

Verify whether the verification is successful (you can enter the IP address of the Manager machine here ):

Swarm is used to build and manage docker clusters.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.