| 1 |
[[ch-rhcs]] |
| 2 |
== Integrating DRBD with Red Hat Cluster |
| 3 |
|
| 4 |
indexterm:[Red Hat Cluster]This chapter describes using DRBD as |
| 5 |
replicated storage for Red Hat Cluster high availability |
| 6 |
clusters. |
| 7 |
|
| 8 |
NOTE: This guide uses the unofficial term _Red Hat Cluster_ to refer |
| 9 |
to a product that has had multiple official product names over its |
| 10 |
history, including _Red Hat Cluster Suite_ and _Red Hat Enterprise |
| 11 |
Linux High Availability Add-On_. |
| 12 |
|
| 13 |
[[s-rhcs-primer]] |
| 14 |
=== Red Hat Cluster background information |
| 15 |
|
| 16 |
[[s-rhcs-fencing]] |
| 17 |
==== Fencing |
| 18 |
|
| 19 |
Red Hat Cluster, originally designed primarily for shared |
| 20 |
storage clusters, relies on node fencing to prevent concurrent, |
| 21 |
uncoordinated access to shared resources. The Red Hat Cluster |
| 22 |
fencing infrastructure relies on the fencing daemon `fenced`, and |
| 23 |
fencing agents implemented as shell scripts. |
| 24 |
|
| 25 |
Even though DRBD-based clusters utilize no shared storage resources |
| 26 |
and thus fencing is not strictly required from DRBD's standpoint, Red |
| 27 |
Hat Cluster Suite still requires fencing even in DRBD-based |
| 28 |
configurations. |
| 29 |
|
| 30 |
[[s-rhcs-rgmanager]] |
| 31 |
==== The Resource Group Manager |
| 32 |
|
| 33 |
The resource group manager (`rgmanager`, alternatively `clurgmgr`) is |
| 34 |
akin to Pacemaker. It serves as the cluster management suite's primary |
| 35 |
interface with the applications it is configured to manage. |
| 36 |
|
| 37 |
[[s-rhcs-resources]] |
| 38 |
===== Red Hat Cluster resources |
| 39 |
|
| 40 |
indexterm:[Red Hat Cluster]A single highly available |
| 41 |
application, filesystem, IP address and the like is referred to as a |
| 42 |
_resource_ in Red Hat Cluster terminology. |
| 43 |
|
| 44 |
Where resources depend on each other -- such as, for example, an NFS |
| 45 |
export depending on a filesystem being mounted -- they form a |
| 46 |
_resource tree_, a form of nesting resources inside another. Resources |
| 47 |
in inner levels of nesting may inherit parameters from resources in |
| 48 |
outer nesting levels. The concept of resource trees is absent in |
| 49 |
Pacemaker. |
| 50 |
|
| 51 |
[[s-rhcs-services]] |
| 52 |
===== Red Hat Cluster services |
| 53 |
|
| 54 |
indexterm:[Red Hat Cluster]Where resources form a co-dependent |
| 55 |
collection, that collection is called a _service_. This is different |
| 56 |
from Pacemaker, where such a collection is referred to as a _resource |
| 57 |
group_. |
| 58 |
|
| 59 |
[[s-rhcs-resource-agents]] |
| 60 |
===== rgmanager resource agents |
| 61 |
|
| 62 |
The resource agents invoked by `rgmanager` are similar to those used by |
| 63 |
Pacemaker, in the sense that they utilize the same shell-based |
| 64 |
API as defined in the Open Cluster Framework (OCF), although Pacemaker |
| 65 |
utilizes some extensions not defined in the framework. Thus in theory, |
| 66 |
the resource agents are largely interchangeable between Red Hat |
| 67 |
Cluster Suite and Pacemaker -- in practice however, the two cluster |
| 68 |
management suites use different resource agents even for similar or |
| 69 |
identical tasks. |
| 70 |
|
| 71 |
Red Hat Cluster resource agents install into the `/usr/share/cluster/` |
| 72 |
directory. Unlike Pacemaker OCF resource agents which are by |
| 73 |
convention self-contained, some Red Hat Cluster resource agents are |
| 74 |
split into a `.sh` file containing the actual shell code, and a |
| 75 |
`.metadata` file containing XML resource agent metadata. |
| 76 |
|
| 77 |
DRBD includes a Red Hat Cluster resource agent. It installs into the |
| 78 |
customary directory as `drbd.sh` and `drbd.metadata`. |
| 79 |
|
| 80 |
[[s-rhcs-config]] |
| 81 |
=== Red Hat Cluster configuration |
| 82 |
|
| 83 |
This section outlines the configuration steps necessary to get Red Hat |
| 84 |
Cluster running. Preparing your cluster configuration is fairly |
| 85 |
straightforward; all a DRBD-based Red Hat Cluster requires are two |
| 86 |
participating nodes (referred to as _Cluster Members_ in Red Hat's |
| 87 |
documentation) and a fencing device. |
| 88 |
|
| 89 |
NOTE: For more information about configuring Red Hat clusters, see |
| 90 |
http://www.redhat.com/docs/manuals/csgfs/[Red Hat's documentation on |
| 91 |
the Red Hat Cluster and GFS.] |
| 92 |
|
| 93 |
|
| 94 |
[[s-rhcs-cluster-conf]] |
| 95 |
==== The `cluster.conf` file |
| 96 |
|
| 97 |
RHEL clusters keep their configuration in a single configuration file, |
| 98 |
indexterm:[Red Hat Cluster]indexterm:[cluster.conf (Red Hat Cluster |
| 99 |
configuration file)]`/etc/cluster/cluster.conf`. You may manage your |
| 100 |
cluster configuration in the following ways: |
| 101 |
|
| 102 |
.Editing the configuration file directly |
| 103 |
This is the most straightforward method. It has no prerequisites other |
| 104 |
than having a text editor available. |
| 105 |
|
| 106 |
.Using the `system-config-cluster` GUI |
| 107 |
This is a GUI application written in Python using Glade. It requires |
| 108 |
the availability of an X display (either directly on a server console, |
| 109 |
or tunneled via SSH). |
| 110 |
|
| 111 |
.Using the Conga web-based management infrastructure |
| 112 |
The Conga infrastructure consists of a node agent ( `ricci`) |
| 113 |
communicating with the local cluster manager, cluster resource |
| 114 |
manager, and cluster LVM daemon, and an administration web application |
| 115 |
( `luci`) which may be used to configure the cluster infrastructure |
| 116 |
using a simple web browser. |
| 117 |
|
| 118 |
|
| 119 |
[[s-rhcs-failover-clusters]] |
| 120 |
=== Using DRBD in Red Hat Cluster fail-over clusters |
| 121 |
|
| 122 |
NOTE: This section deals exclusively with setting up DRBD for Red Hat |
| 123 |
Cluster fail-over clusters not involving GFS. For GFS (and GFS2) |
| 124 |
configurations, please see <<ch-gfs>>. |
| 125 |
|
| 126 |
This section, like <<ch-pacemaker>>, assumes you are about to |
| 127 |
configure a highly available MySQL database with the following |
| 128 |
configuration parameters: |
| 129 |
|
| 130 |
* The DRBD resources to be used as your database storage area is named |
| 131 |
`mysql`, and it manages the device `/dev/drbd0`. |
| 132 |
|
| 133 |
* The DRBD device holds an ext3 filesystem which is to be mounted to |
| 134 |
`/var/lib/mysql` (the default MySQL data directory). |
| 135 |
|
| 136 |
* The MySQL database is to utilize that filesystem, and listen on a |
| 137 |
dedicated cluster IP address, 192.168.42.1. |
| 138 |
|
| 139 |
|
| 140 |
[[s-rhcs-example-cluster-conf]] |
| 141 |
==== Setting up your cluster configuration |
| 142 |
|
| 143 |
To configure your highly available MySQL database, create or modify |
| 144 |
your `/etc/cluster/cluster.conf` file to contain the following |
| 145 |
configuration items. |
| 146 |
|
| 147 |
To do that, open `/etc/cluster/cluster.conf` with your preferred text |
| 148 |
editing application. Then, include the following items in your |
| 149 |
resource configuration: |
| 150 |
|
| 151 |
[source,xml] |
| 152 |
---------------------------- |
| 153 |
<rm> |
| 154 |
<resources /> |
| 155 |
<service autostart="1" name="mysql"> |
| 156 |
<drbd name="drbd-mysql" resource="mysql"> |
| 157 |
<fs device="/dev/drbd/by-res/mysql/0" |
| 158 |
mountpoint="/var/lib/mysql" |
| 159 |
fstype="ext3" |
| 160 |
name="mysql" |
| 161 |
options="noatime"/> |
| 162 |
</drbd> |
| 163 |
<ip address="192.168.42.1" monitor_link="1"/> |
| 164 |
<mysql config_file="/etc/my.cnf" |
| 165 |
listen_address="192.168.42.1" |
| 166 |
name="mysqld"/> |
| 167 |
</service> |
| 168 |
</rm> |
| 169 |
---------------------------- |
| 170 |
|
| 171 |
NOTE: This example assumes a single-volume resource. |
| 172 |
|
| 173 |
Nesting resource references inside one another in `<service/>` is the |
| 174 |
Red Hat Cluster way of expressing resource dependencies. |
| 175 |
|
| 176 |
Be sure to increment the `config_version` attribute, found on the root |
| 177 |
`<cluster>` element, after you have completed your |
| 178 |
configuration. Then, issue the following commands to commit your |
| 179 |
changes to the running cluster configuration: |
| 180 |
|
| 181 |
---------------------------- |
| 182 |
# ccs_tool update /etc/cluster/cluster.conf |
| 183 |
# cman_tool version -r <version> |
| 184 |
---------------------------- |
| 185 |
|
| 186 |
In the second command, be sure to replace _<version>_ with the new |
| 187 |
cluster configuration version number. |
| 188 |
|
| 189 |
NOTE: Both the `system-config-cluster` GUI configuration utility and |
| 190 |
the Conga web based cluster management infrastructure will complain |
| 191 |
about your cluster configuration after including the `drbd` resource |
| 192 |
agent in your `cluster.conf` file. This is due to the design of the |
| 193 |
Python cluster management wrappers provided by these two applications |
| 194 |
which does not expect third party extensions to the cluster |
| 195 |
infrastructure. |
| 196 |
|
| 197 |
Thus, when you utilize the `drbd` resource agent in cluster |
| 198 |
configurations, it is not recommended to utilize |
| 199 |
`system-config-cluster` nor Conga for cluster configuration |
| 200 |
purposes. Using either of these tools to only monitor the cluster's |
| 201 |
status, however, is expected to work fine. |