23.2. 设置 shutdown-lock 集群属性
以下示例将示例集群中的 shutdown-lock
集群属性设置为 true
,并显示节点关闭并再次启动时的它的效果。这个示例集群由三个节点组成:z1.example.com
、z2.example.com
和 z3.example.com
。
流程
将
shutdown-lock
属性设为true
,并验证其值。在本例中,shutdown-lock-limit
属性保持其默认值 0。[root@z3 ~]# pcs property set shutdown-lock=true [root@z3 ~]# pcs property list --all | grep shutdown-lock shutdown-lock: true shutdown-lock-limit: 0
检查集群的状态。在本例中,资源
third
和fifth
运行在z1.example.com
上。[root@z3 ~]# pcs status ... Full List of Resources: ... * first (ocf::pacemaker:Dummy): Started z3.example.com * second (ocf::pacemaker:Dummy): Started z2.example.com * third (ocf::pacemaker:Dummy): Started z1.example.com * fourth (ocf::pacemaker:Dummy): Started z2.example.com * fifth (ocf::pacemaker:Dummy): Started z1.example.com ...
关闭
z1.example.com
,这将停止在该节点上运行的资源。[root@z3 ~] # pcs cluster stop z1.example.com Stopping Cluster (pacemaker)... Stopping Cluster (corosync)...
运行
pcs status
命令可显示节点z1.example.com
脱机,并且z1.example.com
上运行的资源在节点停机时为LOCKED
。[root@z3 ~]# pcs status ... Node List: * Online: [ z2.example.com z3.example.com ] * OFFLINE: [ z1.example.com ] Full List of Resources: ... * first (ocf::pacemaker:Dummy): Started z3.example.com * second (ocf::pacemaker:Dummy): Started z2.example.com * third (ocf::pacemaker:Dummy): Stopped z1.example.com (LOCKED) * fourth (ocf::pacemaker:Dummy): Started z3.example.com * fifth (ocf::pacemaker:Dummy): Stopped z1.example.com (LOCKED) ...
在
z1.example.com
上再次启动集群服务,使其重新加入集群。锁住的资源应该在这个节点上启动,但当它们启动后,它们不一定会停留在同一个节点上。[root@z3 ~]# pcs cluster start z1.example.com Starting Cluster...
在本例中,会在节点
z1.example.com
上恢复第三
和第五个
节点。[root@z3 ~]# pcs status ... Node List: * Online: [ z1.example.com z2.example.com z3.example.com ] Full List of Resources: .. * first (ocf::pacemaker:Dummy): Started z3.example.com * second (ocf::pacemaker:Dummy): Started z2.example.com * third (ocf::pacemaker:Dummy): Started z1.example.com * fourth (ocf::pacemaker:Dummy): Started z3.example.com * fifth (ocf::pacemaker:Dummy): Started z1.example.com ...