这仅适用于观看并尝试过以下复数课程的人。
https://app.pluralsight.com/library/courses/docker-swarm-native-docker-clustering
如果有任何遗体消失,请告诉我我缺少的东西
在马槽上设置Consul Cluster Manger 1
docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul1 --name consul1 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr1-IP -bootstrap-expect 3
Manger 2
docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul2 --name consul2 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr2-IP -join mgr1-IP
Manger 3
docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul3 --name consul3 -v /mnt:/data -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 53:53 progrium/consul -server -advertise mgr3-IP -join mgr1-IP
设置Swarm On manger Manger 1
docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr1 --name mgr1 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr1-IP:2376 consul://mgr1-IP:8500/
Manger 2
docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr2 --name mgr2 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr2-IP:2376 consul://mgr2-IP:8500/
Manger 3
docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -h mgr3 --name mgr3 -d -p 3376:2376 -v /home/ubuntu/.docker:/certs:ro swarm manage --tlsverify --tlscacert=/certs/ca.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem --host=0.0.0.0:2376 --replication --advertise mgr3-IP:2376 consul://mgr3-IP:8500/
设置领事奴隶
节点1
docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt1 --name consul-agt1 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node1-IP -join mgr1-IP
节点2
docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt2 --name consul-agt2 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node2-IP -join mgr1-IP
节点3
docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run --restart=unless-stopped -d -h consul-agt3 --name consul-agt3 -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:8600/udp progrium/consul -rejoin -advertise node3-IP -join mgr1-IP
设置群集奴隶
节点1
docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node1-IP:2376 consul://node1-IP:8500/
节点2
docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node2-IP:2376 consul://node2-IP:8500/
节点3
docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d -h join --name join swarm join --advertise=node3-IP:2376 consul://node3-IP:8500/
设置RegistratorIn All Machines
Manger 1
docker -H tcp://mgr1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
Manger 2
docker -H tcp://mgr2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
Manger 3
docker -H tcp://mgr3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
节点1
docker -H tcp://node1-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
节点2
docker -H tcp://node2-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
节点3
docker -H tcp://node3-IP:2376 --tlsverify --tlscacert=/home/ubuntu/.docker/ca.pem --tlscert=/home/ubuntu/.docker/cert.pem --tlskey=/home/ubuntu/.docker/key.pem run -d --name reg -h reg -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator:latest consul://mgr1-IP:8500/
我面临两个问题,
registrator容器未启动
docker -H tcp:// mgr1-IP:2376 --tlsverify --tlscacert = / home / ubuntu / .docker / ca.pem --tlscert = / home / ubuntu / .docker / cert.pem - tlskey = / home / ubuntu / .docker / key.pem log reg
2016/05/08 06:14:25启动registrator v7 ...
2016/05/08 06:14:25使用consul适配器:consul:// mgr1-IP:8500 /
2016/05/08 06:14:25连接到后端(0/0)
2016/05/08 06:14:25领事:现任领导人mgr2-IP:8300
2016/05/08 06:14:25听Docker事件......
2016/05/08 06:14:25无法连接到Docker端点
连接到客户端后如果我运行一些容器,它会在当前的领导者管理器上执行它自己。不在节点中。
如何解决这两个问题?