使用docker service ps tomcat-service查看当前Tomcat启动的集群信息。
[root@centos7-Master ~]# docker service ps tomcat-service ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR 2vmq4yc9rnsx4etb10z0oah66 tomcat-service.1 192.168.202.14:5000/centos-tomcat858:centos7 centos7-Master Running Running about an hour ago 6hjjuw1jp4037yt48cievtxt5 tomcat-service.2 192.168.202.14:5000/centos-tomcat858:centos7 centos7-Master Running Running 3 minutes ago cpzh34flx1i7e9sksfr1dr3xu \_ tomcat-service.2 192.168.202.14:5000/centos-tomcat858:centos7 centos7-WorkerA Shutdown Shutdown 3 minutes ago eaimtl1swkxrnqhs2h8clodrb tomcat-service.3 192.168.202.14:5000/centos-tomcat858:centos7 centos7-Master Running Running 3 minutes ago 54pdp8oj1ww2mtrw3ac3m0lwb \_ tomcat-service.3 192.168.202.14:5000/centos-tomcat858:centos7 centos7-WorkerA Shutdown Shutdown 3 minutes ago如果我们需要重新启用WorkerA的Swarm集群服务, 我们可以通过docker node update --availability active <NODE-ID>来实现对服务节点的启用。
[root@centos7-Master ~]# docker node update --availability active centos7-WorkerA centos7-WorkerA [root@centos7-Master ~]# docker node inspect --pretty centos7-WorkerA ID: ayxx0k8p3hq04zjuemq6p43rq Hostname: centos7-WorkerA Joined at: 2016-12-26 07:07:13.422672934 +0000 utc Status: State: Ready Availability: Active Platform: Operating System: linux Architecture: x86_64 Resources: CPUs: 4 Memory: 3.703 GiB Plugins: Network: bridge, host, null, overlay Volume: local Engine Version: 1.12.5当我们设置Swarm集群的Worker节点为可用时,它便能接收新的任务:
当服务需要进行扩展时
当对服务的版本进行更新时
当我们对停用另外一个Swarm集群节点时
当任务在另外一个活动状态节点出现失败时