Reference Website cluster configuration methodhttps://hub.docker.com/r/progrium/consul/ The cluster requires the manager and node to communicate consul's discovery service, otherwise, the management node cannot be elected and cannot execute the Docker command. Cluster in the consul work 3 machines, greater than 2 units, the cluster is still working, if, occurs only 1, the cluster fails, unable to select the management node, need to start the data again to reach 3 sets of standards, the cluster can slowly recover. The test finally came to an astonishing conclusion that after I removed the consul cluster, the meta data was automatically recovered when it was pulled back. 10.40.100.145 docker-consul0.venic.com10.40.100.146 docker-consul1.venic.com10.40.100.147 docker-consul2.venic.com first on the mirror server 148, pull a consul image of the official website, easy to wait for the other three on the fast start# Docker pull Progrium/consul && docker tag Progrium/consul:latest docker-registry.venic.com:5000/ Consul:latest # Docker push docker-registry.venic.com:5000/consul:latest 10.40.100.145 on Docker run-d--name consul0--restart=always-v/mnt:/data \- P 8300:8300 \- P 8301:8301 \- P 8301:8301/udp \- P 8302:8302 \- P 8302:8302/udp \- P 8400:8400 \- P 8500:8500 \docker-registry.venic.com:5000/consul:latest-server-advertise 10.40.100.145-bootstrap-expect 3 10.40.100.146 on Docker run-d--name consul1--restart=always-v/mnt:/data \- P 8300:8300 \- P 8301:8301 \- P 8301:8301/udp \- P 8302:8302 \- P 8302:8302/udp \- P 8400:8400 \- P 8500:8500 \docker-registry.venic.com:5000/consul:latest-server-advertise 10.40.100.146-join 10.40.100.145 10.40.100.147 on Docker run-d--name consul2--restart=always-v/mnt:/data \- P 8300:8300 \- P 8301:8301 \- P 8301:8301/udp \- P 8302:8302 \- P 8302:8302/udp \- P 8400:8400 \- P 8500:8500 \docker-registry.venic.com:5000/consul:latest-server-advertise 10.40.100.147-join 10.40.100.145 TCP proxy forwarding in the Nginx upper proxy configuration Consul10.40.42.10and that's Controller1 and 2 .# VI 8500_consul.venic.com_10.40.100.145-147_8500.conf upstream consul.venic.com {server 10.40.100.145:8500;server 10.40.100.146:8500;server 10.40.100.147:8500; }server {Listen 8500;Proxy_pass consul.venic.com;} tests can be tested using the following linkshttp://10.40.42.10:8500/
Docker Cluster Lab Environment Deployment--swarm "3 Registry Service monitoring and Autodiscover component--consul"