Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
9.9.2. 设置 shutdown-lock 集群属性
以下示例将示例集群中的
shutdown-lock 集群属性设置为 true,并显示在关闭并再次启动节点时的影响。这个示例集群由三个节点组成:z 1.example.com、z2.example.com 和 z3.example.com。
- 将
shutdown-lock属性设为true并验证其值。在本例中,shutdown-lock-limit属性维护其默认值 0。[root@z3.example.com ~]#
pcs property set shutdown-lock=true[root@z3.example.com ~]#pcs property list --all | grep shutdown-lockshutdown-lock: true shutdown-lock-limit: 0 - 检查集群的状态。在本例中,资源
三和第五个在z1.example.com上运行。[root@z3.example.com ~]#
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.example.com ~] #
pcs cluster stop z1.example.comStopping Cluster (pacemaker)... Stopping Cluster (corosync)...运行 pcs status 命令可显示节点z1.example.com脱机,并且z1.example.com上运行的资源在节点停机时为LOCKED。[root@z3.example.com ~]#
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.example.com ~]#
pcs cluster start z1.example.comStarting Cluster...在本例中,会在节点 z1.example.com 上恢复第三和第五个节点。[root@z3.example.com ~]#
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 ...