Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
1.4. 高可用性服務的管理
「高可用性服務管理」為 Red Hat 叢集提供了建立、管理高可用性的叢集服務(cluster service)。Red Hat 叢集的高可用性服務管理的主要元件,
rgmanager
,能為應用程式提供即時可用的冷備援(cold failover)。在 Red Hat 叢集裡,應用程式是被設定為其他叢集資源,以組成高效能的叢集服務。高效能叢集服務可以從一個節點備援到另一個節點,使用叢集的用戶並不會感受到明顯的中斷。會發生叢集服務備援,是因為叢集節點失效,或叢集系統管理者將服務從一個節點移到另一個節點(例如停機檢查一台節點)。
要建立高可用性的服務,您必須在叢集設定檔裡設定。叢集服務包括叢集資源(resource)。叢集資源是您建立、管理叢集設定檔的基石 — 舉例來說,一組 IP 位址、一個啟動程式的程序檔、或是一個 Red Hat GFS 的共享分割區。
You can associate a cluster service with a failover domain. A failover domain is a subset of cluster nodes that are eligible to run a particular cluster service (refer to 圖形 1.9, “備援區域”).
注意
備援區域並「不」需要操作。
叢集服務一次只能在節點上執行,以保持資料的完整性。您可以指定備援區域的備援優先順序。指定備援的優先順序包含指定備援區域中每個節點的優先等級。優先等級會決定備援的順序 — 亦即決定叢集服務該被備援到哪個節點。如果您不指定備援順序,那麼服務就會備援到叢集中的任何一個節點上。同時,您可以指定備援服務只能在限定的、相關的備援區域上執行。(當一項叢集服務與非受限的備援區域相關連時,如果備援區域的成員都不能使用,那麼該服務會在任何節點上執行。)
In 圖形 1.9, “備援區域”, Failover Domain 1 is configured to restrict failover within that domain; therefore, Cluster Service X can only fail over between Node A and Node B. Failover Domain 2 is also configured to restrict failover with its domain; additionally, it is configured for failover priority. Failover Domain 2 priority is configured with Node C as priority 1, Node B as priority 2, and Node D as priority 3. If Node C fails, Cluster Service Y fails over to Node B next. If it cannot fail over to Node B, it tries failing over to Node D. Failover Domain 3 is configured with no priority and no restrictions. If the node that Cluster Service Z is running on fails, Cluster Service Z tries failing over to one of the nodes in Failover Domain 3. However, if none of those nodes is available, Cluster Service Z can fail over to any node in the cluster.

圖形 1.9. 備援區域
圖形 1.10, “Web Server Cluster Service Example” shows an example of a high-availability cluster service that is a web server named "content-webserver". It is running in cluster node B and is in a failover domain that consists of nodes A, B, and D. In addition, the failover domain is configured with a failover priority to fail over to node D before node A and to restrict failover to nodes only in that failover domain. The cluster service comprises these cluster resources:
- IP 位址來源 — IP 位址 10.10.10.201。
- An application resource named "httpd-content" — a web server application init script
/etc/init.d/httpd
(specifyinghttpd
). - A file system resource — Red Hat GFS named "gfs-content-webserver".

圖形 1.10. Web Server Cluster Service Example
用戶端透過 IP 位址 10.10.10.201 連上叢集服務,與網站伺服器的應用程式 httpd-content 互動。httpd-content 應用程式會使用 gfs-content-webserver 檔案系統。如果節點 B 失效,content-webserver 叢集服務就會被備援到節點 D 上面去。如果節點 D 無法使用或失效,這項服務就會被備援到節點 A。對叢集的用戶端來說,備援過程並沒有帶來明顯的服務中斷。另一個叢集節點會透過同樣的 IP 位址來存取叢集服務,一如備援之前。