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-lock 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-lock shutdown-lock: true shutdown-lock-limit: 0Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 检查集群的状态。在本例中,资源
三和第五个在z1.example.com上运行。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 关闭
z1.example.com,这将停止该节点上运行的资源。[root@z3.example.com ~] # pcs cluster stop z1.example.com Stopping Cluster (pacemaker)... Stopping Cluster (corosync)...
[root@z3.example.com ~] # pcs cluster stop z1.example.com Stopping Cluster (pacemaker)... Stopping Cluster (corosync)...Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行 pcs status 命令可显示节点z1.example.com脱机,并且z1.example.com上运行的资源在节点停机时为LOCKED。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 在
z1.example.com上再次启动群集服务,使其重新加入集群。锁定的资源应该在这个节点上启动,但当它们启动后,它们不一定会停留在同一个节点上。[root@z3.example.com ~]# pcs cluster start z1.example.com Starting Cluster...
[root@z3.example.com ~]# pcs cluster start z1.example.com Starting Cluster...Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在本例中,会在节点 z1.example.com 上恢复第三和第五个节点。Copy to Clipboard Copied! Toggle word wrap Toggle overflow