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.comz2.example.comz3.example.com
  1. 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
    
  2. 检查集群的状态。在本例中,资源 第五个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
    ...
    
  3. 关闭 z1.example.com,这将停止该节点上运行的资源。
    [root@z3.example.com ~] # pcs cluster stop z1.example.com
    Stopping 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)
    ...
    
  4. z1.example.com 上再次启动群集服务,使其重新加入集群。锁定的资源应该在这个节点上启动,但当它们启动后,它们不一定会停留在同一个节点上。
    [root@z3.example.com ~]# pcs cluster start z1.example.com
    Starting 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
    
    ...