Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

B.3.5. 測試資源配置

在〈節 B.3.4, “透過 pcs 指令來建立資源和資源群組”〉中顯示的叢集狀態裡,所有資源皆在節點 z1.example.com 上執行。您可藉由使用下列程序來將第一個節點設為 standby 模式(在這之後該節點將無法再為資源提供服務),以測試資源群組是否會備援至節點 z2.example.com
  1. 下列指令會使 z1.example.com 節點進入 standby 模式中。
    root@z1 ~]# pcs cluster standby z1.example.com
  2. 在將 z1 節點設為 standby 模式後,請檢查叢集狀態。請注意,所有資源現在都應在 z2 上運作。
    [root@z1 ~]# pcs status
    Cluster name: my_cluster
    Last updated: Wed Jul 31 17:16:17 2013
    Last change: Wed Jul 31 17:18:34 2013 via crm_attribute on z1.example.com
    Stack: corosync
    Current DC: z2.example.com (2) - partition with quorum
    Version: 1.1.10-5.el7-9abe687
    2 Nodes configured
    6 Resources configured
    
    
    Node z1.example.com (1): standby
    Online: [ z2.example.com ]
    
    Full list of resources:
    
     myapc	(stonith:fence_apc_snmp):	Started z1.example.com 
     Resource Group: apachegroup
         my_lvm	(ocf::heartbeat:LVM):	Started z2.example.com 
         my_fs	(ocf::heartbeat:Filesystem):	Started z2.example.com 
         VirtualIP	(ocf::heartbeat:IPaddr2):	Started z2.example.com 
         Website	(ocf::heartbeat:apache):	Started z2.example.com
    所定義之 IP 位址的網站應該會繼續顯示而不會受到干擾。
  3. 若要使 z1standby 模式中退出,請執行下列指令。
    root@z1 ~]# pcs cluster unstandby z1.example.com

    注意

    將節點退出 standby 模式不會造成資源備援至該節點。欲取得有關於如何控制資源能在哪個節點上執行,請參閱《Red Hat High Availability Add-On 參照指南》中有關於配置叢集資源的章節。