5 月 162018
Docker Swarm集群管理节点的提升和降级
查看集群节点状态,仅有一个管理节点
[root@swarm1 ~]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION rlle6k39z3xk82f1wqmjpd4m4 * swarm1 Ready Active Leader 18.03.1-ce fzi0eoey60bd25cklvt5qg6p5 swarm2 Ready Active 18.03.1-ce 59optctp5n9zvv3lvaifel7bx swarm3 Ready Active 18.03.1-ce ixqldqaby2jrgfqx7ckjpg0zs swarm4 Ready Active 18.03.1-ce [root@swarm1 ~]#
查看工作节点仅监听7946端口
[root@swarm4 ~]# netstat -lnt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp6 0 0 :::7946 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN [root@swarm4 ~]#
提升swarm4为管理节点
[root@swarm1 ~]# docker node promote swarm4 Node swarm4 promoted to a manager in the swarm. [root@swarm1 ~]#
查看swarm4节点端口监听状态,新增监听2237端口
[root@swarm4 ~]# netstat -lnt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp6 0 0 :::2377 :::* LISTEN tcp6 0 0 :::7946 :::* LISTEN tcp6 0 0 :::22 :::* LISTEN tcp6 0 0 ::1:25 :::* LISTEN [root@swarm4 ~]#
在管理节点查看集群节点状态
降级为工作节点
[root@swarm1 ~]# docker node demote swarm4
Manager swarm4 demoted in the swarm.
[root@swarm1 ~]#
集群管理节点容错数量