ID NAME MODE REPLICAS IMAGE
ira3ezabroai php replicated 1/1 192.168.63.217:5000/lnmp/php:1.0
kcxqzxwe0dzb mysql replicated 1/1 192.168.63.217:5000/lnmp/mysql:1.0
ufn1n5phtsqn web replicated 2/2 192.168.63.217:5000/lnmp/nginx:1.0
#####
[root@master wordpress]# docker service ps php
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
ptxokpvq1b7s php.1 192.168.63.217:5000/lnmp/php:1.0 master Running Running 5 minutes ago
[root@master wordpress]# docker service ps mysql
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
zowbxqnr9toi mysql.1 192.168.63.217:5000/lnmp/mysql:1.0 node2 Running Running 2 minutes ago
[root@master wordpress]# docker service ps web
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
vhk44hij7gnu web.1 192.168.63.217:5000/lnmp/nginx:1.0 node1 Running Running 3 minutes ago
u1vdnr0ujzl7 web.2 192.168.63.217:5000/lnmp/nginx:1.0 node2 Running Running about a minute ago
14、我们已经确认所有的容器都已经起起来并且正常运行了,访问一下web就可以进行80端口的访问了,192.168.63.217:
###
####直接到安装完成:
15、为了测试高可用性,我们把node1节点关闭掉,看容器是否转移:
我们在node1执行关闭docker:
[root@node1 web]# systemctl stop docker
16、在master节点上查看一下状态:
[root@master web]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e9naz0ctzaaer4bwleruo34x6 * master Ready Active Leader
rfcbavxd8yrixximm9e1i6dsn node1 Down Active
shrzku0k3xx87526lkkkyrxsi node2 Ready Active
17、我们可以看到node1节点已经Down,然后我们的Docker 容器也已经转移到了别的worker节点上:
[root@master web]# docker service ps php