centos7搭建Docker Swarm 集群
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7搭建Docker Swarm 集群相关的知识,希望对你有一定的参考价值。
10.6.3.142 node1 Swarm 10.6.3.143 node2 10.6.3.144 node3 #Swarm yum install docker rpm -e lvm2-7:2.02.105-14.el7.x86_64 --nodeps yum install docker -y systemctl start docker docker pull swarm cp /etc/sysconfig/docker /etc/sysconfig/docker.bk vi /etc/sysconfig/docker OPTIONS=‘--selinux-enabled --log-driver=journald‘ OPTIONS=‘-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock‘ systemctl restart docker ps -ef |grep docker ss -lntup|grep 2375 systemctl restart docker docker run --rm swarm create 8fedf0001aaa250851d310610d126f4a docker run -d swarm join --addr=10.6.3.142:2375 token://8fedf0001aaa250851d310610d126f4a scp /etc/sysconfig/docker [email protected]:/etc/sysconfig/ scp /etc/sysconfig/docker [email protected]:/etc/sysconfig/ docker run -d -p 2376:2375 swarm manage token://8fedf0001aaa250851d310610d126f4a #该红色端口可用任意空闲端口 docker run --rm swarm list token://8fedf0001aaa250851d310610d126f4a docker -H tcp://10.6.3.142:2376 info #node2 yum install docker rpm -e lvm2-7:2.02.105-14.el7.x86_64 --nodeps yum install docker -y docker pull swarm systemctl start docker docker pull swarm vi /etc/sysconfig/docker OPTIONS=‘--selinux-enabled --log-driver=journald‘ OPTIONS=‘-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock‘ service docker restart ss -lntup|grep 2375 docker run -d swarm join --addr=10.6.3.143:2375 token://8fedf0001aaa250851d310610d126f4a #node3 yum install docker rpm -e lvm2-7:2.02.105-14.el7.x86_64 --nodeps yum install docker -y docker pull swarm systemctl start docker docker pull swarm vi /etc/sysconfig/docker OPTIONS=‘--selinux-enabled --log-driver=journald‘ OPTIONS=‘-H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock‘ systemctl restart docker ss -lntup|grep 2375 docker run -d swarm join --addr=10.6.3.144:2375 token://8fedf0001aaa250851d310610d126f4a ================ firewall-cmd --zone=public --permanent --add-port=2375/tcp firewall-cmd --reload ================ [[email protected] ~]# docker -H tcp://10.6.3.142:2376 info Containers: 9 Running: 4 Paused: 0 Stopped: 5 Images: 5 Server Version: swarm/1.2.5 Role: primary Strategy: spread Filters: health, port, containerslots, dependency, affinity, constraint Nodes: 3 node1: 10.6.3.142:2375 ID: KUJM:JPIB:6KYA:ZDKL:XBPZ:JECY:JOH7:JS2C:2YXP:SK5K:KVMQ:3ZPL Status: Healthy Containers: 4 (2 Running, 0 Paused, 2 Stopped) Reserved CPUs: 0 / 1 Reserved Memory: 0 B / 1.005 GiB Labels: executiondriver=native-0.2, kernelversion=3.10.0-123.el7.x86_64, operatingsystem=CentOS Linux 7 (Core), storagedriver=devicemapper UpdatedAt: 2016-08-26T09:19:06Z ServerVersion: 1.10.3 node2: 10.6.3.143:2375 ID: XBGE:KTF6:AFXG:6ZRP:MS25:J4WR:ICS5:WTWQ:VUWV:5CLK:TZZ5:YDKN Status: Healthy Containers: 1 (1 Running, 0 Paused, 0 Stopped) Reserved CPUs: 0 / 1 Reserved Memory: 0 B / 1.005 GiB Labels: executiondriver=native-0.2, kernelversion=3.10.0-123.el7.x86_64, operatingsystem=CentOS Linux 7 (Core), storagedriver=devicemapper UpdatedAt: 2016-08-26T09:19:31Z ServerVersion: 1.10.3 node3: 10.6.3.144:2375 ID: EOCY:EDVQ:2MRP:IVKV:MTRH:4B3K:2EPF:CVFD:HNE2:YWTQ:A2ON:P2FI Status: Healthy Containers: 4 (1 Running, 0 Paused, 3 Stopped) Reserved CPUs: 0 / 1 Reserved Memory: 0 B / 1.005 GiB Labels: executiondriver=native-0.2, kernelversion=3.10.0-123.el7.x86_64, operatingsystem=CentOS Linux 7 (Core), storagedriver=devicemapper UpdatedAt: 2016-08-26T09:19:55Z ServerVersion: 1.10.3 Plugins: Volume: Network: Kernel Version: 3.10.0-123.el7.x86_64 Operating System: linux Architecture: amd64 Number of Docker Hooks: 2 CPUs: 3 Total Memory: 3.014 GiB Name: 2ad8a91ba615 docker -H tcp://10.6.3.142:2376 run -d --name node3 centos docker -H tcp://10.6.3.142:2376 ps -a docker -H tcp://10.6.3.142:2376 images docker -H tcp://10.6.3.142:2376 pull mysql
以上是关于centos7搭建Docker Swarm 集群的主要内容,如果未能解决你的问题,请参考以下文章
docker swarm使用keepalived+haproxy搭建基于percona-xtradb-cluster方案的高可用mysql集群