1.4. 高可用性服务管理
高可用性服务管理提供在 Red Hat 群集中创建和管理高可用性群集服务(cluster service)的能力。Red Hat 群集里的高可用性服务管理的关键组件是
rgmanager
,它实现了 off-the-shelf 应用程序的冷失效切换(cold failover)。在 Red Hat 群集里,应用程序和其他群集资源进行配置来组成高可用性的群集服务。高可用性群集服务可以从一个节点故障切换到另外一个节点,而不会对群集客户有明显的影响。当某个群集节点发生故障或群集系统管理员将服务迁移(例如,需要对这个节点进行预定的维护时)到另外一个节点时,群集服务的故障切换都可以发生。
要创建高可用性服务,您必须在群集配置文件里进行配置。群集服务由群集资源组成。群集资源是您在群集配置文件里创建和管理的构建块(building block) — 例如,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 地址资源 — 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 访问群集服务,和 web 服务器应用程序 httpd-content 进行交互。httpd-content 使用 gfs-content-webserver 文件系统。如果节点 B 发生故障,content-webserver 群集服务将切换到节点 D。如果节点 D 不可用或者也发生了故障,服务将切换至节点 A。故障切换将对群集客户不产生明显的影响。和切换前一样,群集服务将可以用相同的 IP 地址从另外一个群集节点进行访问。