首页 > 代码库 > Docker集群实验环境布署--swarm【4 管理组件--manager】
Docker集群实验环境布署--swarm【4 管理组件--manager】
主机分配如下,支持双活,中断其中1台,primary会通过consul自动重新选举
10.40.100.141 docker-manager0.venic.com
10.40.100.142 docker-manager1.venic.com
首先在镜像服务器上148上,拉取一个官网 的 consul镜像,方便等下在其它三台上快速启动
# docker pull swarm && docker tag swarm:latest docker-registry.venic.com:5000/swarm:latest
# docker push docker-registry.venic.com:5000/swarm:latest
10.40.100.141上
docker run -d -p 4000:4000 --restart=always --name manager0 docker-registry.venic.com:5000/swarm:latest manage -H :4000 --replication --advertise 10.40.100.141:4000 consul://docker-consul.venic.com:8500
10.40.100.142上
docker run -d -p 4000:4000 --restart=always --name manager1 docker-registry.venic.com:5000/swarm:latest manage -H :4000 --replication --advertise 10.40.100.142:4000 consul://docker-consul.venic.com:8500
在2台机器上执行查看状态,可以看到选举了谁做主
[root@docker-manager0 /]# docker -H :4000 info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: swarm/1.2.5
Role: primary
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint
Nodes: 0
Plugins:
Volume:
Network:
Swarm:
NodeID:
Is Manager: false
Node Address:
Security Options:
Kernel Version: 3.10.0-514.2.2.el7.x86_64
Operating System: linux
Architecture: amd64
CPUs: 0
Total Memory: 0 B
Name: 27fbbfe0fae4
Docker Root Dir:
Debug Mode (client): false
Debug Mode (server): false
WARNING: No kernel memory limit support
[root@docker-manager1 /]# docker -H :4000 info
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: swarm/1.2.5
Role: replica
Primary: 10.40.100.141:4000
Strategy: spread
Filters: health, port, containerslots, dependency, affinity, constraint
Nodes: 0
Plugins:
Volume:
Network:
Swarm:
NodeID:
Is Manager: false
Node Address:
Security Options:
Kernel Version: 3.10.0-514.2.2.el7.x86_64
Operating System: linux
Architecture: amd64
CPUs: 0
Total Memory: 0 B
Name: 716ec5e0ef90
Docker Root Dir:
Debug Mode (client): false
Debug Mode (server): false
WARNING: No kernel memory limit support
Docker集群实验环境布署--swarm【4 管理组件--manager】
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。