Appendix F. High Availability LVM (HA-LVM)
The Red Hat High Availability Add-On provides support for high availability LVM volumes (HA-LVM) in a failover configuration. This is distinct from active/active configurations enabled by the Clustered Logical Volume Manager (CLVM), which is a set of clustering extensions to LVM that allow a cluster of computers to manage shared storage.
When to use CLVM or HA-LVM should be based on the needs of the applications or services being deployed.
- If the applications are cluster-aware and have been tuned to run simultaneously on multiple machines at a time, then CLVM should be used. Specifically, if more than one node of your cluster will require access to your storage which is then shared among the active nodes, then you must use CLVM. CLVM allows a user to configure logical volumes on shared storage by locking access to physical storage while a logical volume is being configured, and uses clustered locking services to manage the shared storage. For information on CLVM, and on LVM configuration in general, see Logical Volume Manager Administration.
- If the applications run optimally in active/passive (failover) configurations where only a single node that accesses the storage is active at any one time, you should use High Availability Logical Volume Management agents (HA-LVM).
Most applications will run better in an active/passive configuration, as they are not designed or optimized to run concurrently with other instances. Choosing to run an application that is not cluster-aware on clustered logical volumes may result in degraded performance if the logical volume is mirrored. This is because there is cluster communication overhead for the logical volumes themselves in these instances. A cluster-aware application must be able to achieve performance gains above the performance losses introduced by cluster file systems and cluster-aware logical volumes. This is achievable for some applications and workloads more easily than others. Determining what the requirements of the cluster are and whether the extra effort toward optimizing for an active/active cluster will pay dividends is the way to choose between the two LVM variants. Most users will achieve the best HA results from using HA-LVM.
HA-LVM and CLVM are similar in the fact that they prevent corruption of LVM metadata and its logical volumes, which could otherwise occur if multiple machines are allowed to make overlapping changes. HA-LVM imposes the restriction that a logical volume can only be activated exclusively; that is, active on only one machine at a time. This means that only local (non-clustered) implementations of the storage drivers are used. Avoiding the cluster coordination overhead in this way increases performance. CLVM does not impose these restrictions - a user is free to activate a logical volume on all machines in a cluster; this forces the use of cluster-aware storage drivers, which allow for cluster-aware file systems and applications to be put on top.
HA-LVM can be setup to use one of two methods for achieving its mandate of exclusive logical volume activation.
- The preferred method uses CLVM, but it will only ever activate the logical volumes exclusively. This has the advantage of easier setup and better prevention of administrative mistakes (like removing a logical volume that is in use). In order to use CLVM, the High Availability Add-On and Resilient Storage Add-On software, including the
clvmddaemon, must be running.The procedure for configuring HA-LVM using this method is described in Section F.1, “Configuring HA-LVM Failover with CLVM (preferred)”.
- The second method uses local machine locking and LVM "tags". This method has the advantage of not requiring any LVM cluster packages; however, there are more steps involved in setting it up and it does not prevent an administrator from mistakenly removing a logical volume from a node in the cluster where it is not active. The procedure for configuring HA-LVM using this method is described in Section F.2, “Configuring HA-LVM Failover with Tagging”.
F.1. Configuring HA-LVM Failover with CLVM (preferred)
To set up HA-LVM failover (using the preferred CLVM variant), perform the following steps:
- Ensure that your system is configured to support CLVM, which requires the following:
- The High Availability Add-On and Resilient Storage Add-On are installed, including the
cmirrorpackage if the CLVM logical volumes are to be mirrored.
locking_typeparameter in the global section of the
/etc/lvm/lvm.conffile is set to the value '3'.
- The High Availability Add-On and Resilient Storage Add-On software, including the
clvmddaemon, must be running. For CLVM mirroring, the
cmirrordservice must be started as well.
- Create the logical volume and file system using standard LVM and file system commands, as in the following example.
vgcreate -cy shared_vg /dev/sd[cde]1#
lvcreate -L 10G -n ha_lv shared_vg#
lvchange -an shared_vg/ha_lvFor information on creating LVM logical volumes, refer to Logical Volume Manager Administration.
- Edit the
/etc/cluster/cluster.conffile to include the newly created logical volume as a resource in one of your services. Alternately, you can use Conga or the
ccscommand to configure LVM and file system resources for the cluster. The following is a sample resource manager section from the
/etc/cluster/cluster.conffile that configures a CLVM logical volume as a cluster resource:
<rm> <failoverdomains> <failoverdomain name="FD" ordered="1" restricted="0"> <failoverdomainnode name="neo-01" priority="1"/> <failoverdomainnode name="neo-02" priority="2"/> </failoverdomain> </failoverdomains> <resources> <lvm name="lvm" vg_name="shared_vg" lv_name="ha-lv"/> <fs name="FS" device="/dev/shared_vg/ha-lv" force_fsck="0" force_unmount="1" fsid="64050" fstype="ext4" mountpoint="/mnt" options="" self_fence="0"/> </resources> <service autostart="1" domain="FD" name="serv" recovery="relocate"> <lvm ref="lvm"/> <fs ref="FS"/> </service> </rm>