Docker Swarm cluster

Source: Internet
Author: User

Docker Swarm cluster


IP 10.6.17.11 Management Node


IP 10.6.17.12 Node A


IP 10.6.17.13 Node B


IP 10.6.17.14 Node C



Installing Swarm all nodes


Docker Pull Swarm



# # Control Node Installation zookeeper


zk://10.6.17.11:2181




# # Modify-H Add TCP port




Sed-i ' s/-h fd:\/\//-h tcp:\/\/0.0.0.0:2375/g '/lib/systemd/system/docker.service



Systemctl Daemon-reload


Systemctl Restart Docker







# # Add nodes to the cluster


A:

Docker-h tcp://10.6.17.12:2375 Run--name node_1--restart=always-d swarm join--addr=10.6.17.12:2375 zk://10.6.17.11/s Warm




B:

Docker-h tcp://10.6.17.13:2375 Run--name node_2--restart=always-d swarm join--addr=10.6.17.13:2375 zk://10.6.17.11/s Warm




C:

Docker-h tcp://10.6.17.14:2375 Run--name node_3--restart=always-d swarm join--addr=10.6.17.14:2375 zk://10.6.17.11/s Warm



# # List of a B C three node information


Docker-h tcp://10.6.17.11:2375 run--RM swarm list Zk://10.6.17.11:2181/swarm


10.6.17.12:2375

10.6.17.13:2375

10.6.17.14:2375



# # Add Management Service


Docker-h tcp://10.6.17.11:2375 Run--name manage--restart=always-d-p 6666:2375 Swarm manage Zk://10.6.17.11:2181/swarm





# # Management node, managing A B C Cluster


[Email protected] docker]# docker-h tcp://10.6.17.11:6666 ps-a


CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

3629e76de67c swarm "/swarm join--addr=1" 4 minutes ago up 4 minutes 2375/tcp Localhost.localdomain/node_1

325B71855B86 swarm "/swarm join--addr=1" 6 minutes ago up about a minute 2375/tcp Localhost.localdomain/node_3

b888bbbfe594 swarm "/swarm join--addr=1" 6 minutes ago up 6 minutes 2375/tcp Localhost.localdomain/node_2





# # in the cluster, run the container


Docker-h tcp://10.6.17.11:6666 run-d--name web1 nginx

Docker-h tcp://10.6.17.11:6666 run-d--name web2 nginx

Docker-h tcp://10.6.17.11:6666 run-d--name web3 nginx


Docker Swarm cluster

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.