【docker】docker warm 节点降级和升级

1.将一个从节点提升为主节点

[root@es1 swarm]# docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
lbcg0z4t2n3lgn4nld4brdsx7 *   es1        Ready     Active         Leader           20.10.16
gtwzo26t996ht7ohfsy533l2u     es2        Ready     Active                          20.10.16
v5zlbhia4kial3jqjadqm7xia     es3        Ready     Active                          20.10.16

[root@es1 swarm]# docker node promote es2
Node es2 promoted to a manager in the swarm.
[root@es1 swarm]# docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
lbcg0z4t2n3lgn4nld4brdsx7 *   es1        Ready     Active         Leader           20.10.16
gtwzo26t996ht7ohfsy533l2u     es2        Ready     Active         Reachable        20.10.16
v5zlbhia4kial3jqjadqm7xia     es3        Ready     Active                          20.10.16

2.故障转移 

--主节点重启
[root@es1 swarm]# systemctl stop docker
[root@es1 swarm]# systemctl start docker
[root@es1 ~]# docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
lbcg0z4t2n3lgn4nld4brdsx7 *   es1        Ready     Active         Reachable        20.10.16
gtwzo26t996ht7ohfsy533l2u     es2        Ready     Active         Leader           20.10.16
v5zlbhia4kial3jqjadqm7xia     es3        Ready     Active                          20.10.16

--由此可见主节点重启后:es1/es2 发生了角色转换。

3.再次进行故障转移 

[root@es2 data]# systemctl stop docker
[root@es2 data]# systemctl start docker
[root@es1 ~]# docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
lbcg0z4t2n3lgn4nld4brdsx7 *   es1        Ready     Active         Leader           20.10.16
gtwzo26t996ht7ohfsy533l2u     es2        Ready     Active         Reachable        20.10.16
v5zlbhia4kial3jqjadqm7xia     es3        Ready     Active                          20.10.16

4.将节点es2降级为工作节点

[root@es1 ~]# docker node demote es2
Manager es2 demoted in the swarm.
[root@es1 ~]# docker node ls
ID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
lbcg0z4t2n3lgn4nld4brdsx7 *   es1        Ready     Active         Leader           20.10.16
gtwzo26t996ht7ohfsy533l2u     es2        Ready     Active                          20.10.16
v5zlbhia4kial3jqjadqm7xia     es3        Ready     Active                          20.10.16

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值