My current cluster environment is as follows:
~ $ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
czn1ts6u2o24pcyeojlsr9ai7 node4 Ready Active
lrlhx7smzo9rafckep5b05fgw node3 Ready Active
s38rdi1wlxqbvtfl1sa3ne17r * node1 Ready Active Leader
uubznl6kas1mpd5evpqamtr9x node5 Ready Active
z4otpoy5a8m8px2e3bh9jy5jd node2 Ready Active
Then i promote node2, node3.
~ $ docker node promote node2 node3
Node node2 promoted to a manager in the swarm.
Node node3 promoted to a manager in the swarm.
Check the current node status again.
~ $ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
czn1ts6u2o24pcyeojlsr9ai7 node4 Ready Active
lrlhx7smzo9rafckep5b05fgw node3 Ready Active Reachable
s38rdi1wlxqbvtfl1sa3ne17r * node1 Ready Active Leader
uubznl6kas1mpd5evpqamtr9x node5 Ready Active
z4otpoy5a8m8px2e3bh9jy5jd node2 Ready Active Reachable
Then I started to STOP leader node (manager)
~ $ docker-machine stop node1
Stopping "node1" ...
Machine "node1" was stopped.
Execute the following command again
~ $ docker node ls
error during connect: Get https://192.168.99.100:2376/v1.30/nodes: dial tcp 192.168.99.100:2376: getsockopt: no route to host
Then the question arises, how do I know who is the leader node? , because I only know leader node, began to carry out
eval $(docker-machine env 'leader node name')
Found it
~ $ docker node ls error during connect: Get https://192.168.99.100:2376/v1.30/nodes: dial tcp 192.168.99.100:2376: getsockopt: no route to host ~ $ docker-machine ssh node2 ## . ## ## ## == ## ## ## ## ## === /"""""""""""""""""\___/ === ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ \______ o __/ \ \ __/ \____\_______/ _ _ ____ _ _ | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| Boot2Docker version 17.10.0-ce, build HEAD : 34fe485 - Wed Oct 18 17:16:34 UTC 2017 Docker version 17.10.0-ce, build f4ffd25 docker@node2:~$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS s38rdi1wlxqbvtfl1sa3ne17r node1 Down Active Unreachable z4otpoy5a8m8px2e3bh9jy5jd * node2 Ready Active Reachable lrlhx7smzo9rafckep5b05fgw node3 Ready Active Leader czn1ts6u2o24pcyeojlsr9ai7 node4 Ready Active uubznl6kas1mpd5evpqamtr9x node5 Ready Active docker@node2:~$