What is a Highly Available LVM (HA-LVM) configuration and how do I implement it?
Environment
- Red Hat Enterprise Linux (RHEL) 6, 7, 8 or 9 with the High Availability Add On
rgmanagerorpacemakerresource management- LVM is to be used in an active/passive manner (only one node will need access to a particular volume at a time)
Issue
-
How can I configure my cluster service or resource to activate and monitor shared LVM volumes?
-
Uncontrolled simultaneous access to shared storage can lead to data corruption. Storage access must be managed like any other active/passive service - it must only be active on a single machine at a time.
-
Is there a way to configure LVM volumes for active/passive use in a High Availability cluster?
Resolution
An active/passive LVM or LVM-activate resource should never be cloned or corruption could occur in the LVM metadata or filesystem.
For active/passive, exclusive LVM access: HA-LVM with system_id
With pacemaker on RHEL 9
- 1.4. LVM logical volumes in a Red Hat high availability cluster
- 6.1. Configuring an LVM volume with an ext4 file system in a Pacemaker cluster | Configuring and managing high availability clusters
With pacemaker on RHEL 8
- 1.6. LVM logical volumes in a Red Hat high availability cluster
- 5.3. Creating the resources and resource groups | Configuring and managing high availability clusters Red Hat Enterprise Linux 8
- How to configure HA-LVM Cluster using system_id in RHEL 8 and above?
For active/passive, exclusive LVM access: HA-LVM with tagging
With pacemaker on RHEL 8
With pacemakeron RHEL 6/7
-
Method:
- On every node in the cluster, ensure that
locking_typeis set to 1 as needed, and thatlvm2-lvmetadis disabled, by running the following command:
# # lvm2-2.02.118-2 or newer # lvmconf --enable-halvm --services --startstopservices # # Older than lvm2-2.02.118-2 # lvmconf --enable-halvm # systemctl disable lvm2-lvmetad.service ## RHEL 7 # systemctl stop lvm2-lvmetad.service ## RHEL 7 # chkconfig lvm2-lvmetad off ## RHEL 6 # service lvm2-lvmetad stop ## RHEL 6Also ensure that the volume group has the the "clustered" attribute disabled:
# vgchange -cn <vg>This clustered attribute is not needed in active/passive setups with tagging.
- On every node in the cluster, configure a
volume_listin/etc/lvm/lvm.confthat only contains local volume groups that are not shared by cluster nodes. There is no need to include a tag matching the node name as was required forrgmanagerconfigurations. Example configuration:
volume_list = [ "VolGroup00" ]-
On every node in the cluster, remake the initramfs for the current kernel version
-
On one node, create an exclusive LVM resource using
pcs. For example:
# pcs resource create my_lvm_resource LVM volgrpname=my_vg exclusive=true - On every node in the cluster, ensure that
-
Pacemakeris supported only on certain releases of RHEL 6 -
This method prevents any modification or manipulation of shared volumes by anything but
Pacemaker -
Can be used with either High Availability Add on or Resilient Storage Add on entitlements as
lvm2-cluster(clvmd) is not required. -
The
LVMresource agent available forPacemakercan only manage entire volume groups, rather than individual logical volumes as thelvmagent forrgmanagercan.
With rgmanager on RHEL 6
-
Method:
-
More configuration steps and similar protection as CLVM variant, but does not prevent accidental removal a logical volume from an inactive node.
-
Can be used with either High Availability Add on or Resilient Storage Add on entitlements as
lvm2-cluster(clvmd) is not required -
This method is compatible with stretch clusters.
-
This method is compatible with Redundant Ring Protocol (RRP).
-
locking_typeshould be set to 1 andlvm2-lvmetadshould be disabled on all nodes with:# # lvm2-2.02.118-2 or newer # lvmconf --enable-halvm --services --startstopservices # # Older than lvm2-2.02.118-2 # lvmconf --enable-halvm # chkconfig lvm2-lvmetad off # service lvm2-lvmetad stop
Root Cause
- In RHEL 6, there is support in rgmanager for highly-available LVM volumes (HA-LVM) in a failover (active/passive) configuration.
- This is distinct from the active/active configurations enabled by Clustered Logical Volume Manager (CLVM). When neeeded, active/passive HA-LVM can now be configured with CLVM support.
- The choice of Active/Passive HA-LVM or Active/Active CLVM should be based on the needs of the applications or services that are being deployed.
- If the applications are cluster-aware and have been tuned to access data simultaneously on multiple nodes at a time, then CLVM should be used.
- If the applications run optimally in active/passive (failover) configurations, then HA-LVM is the best choice.
- 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 nodes where 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.
- 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.
- Support for the CLVM variant of HA-LVM was added in RHEL5.6 and every version of RHEL6.
- This limitation only applies to HA-LVM with
clvmd.lvm2-clusterandclvmdare supported without HA-LVM for active/active access to volumes throughout RHCS 4, RHEL 5, 6, and 7.
- This limitation only applies to HA-LVM with
- Support for the Tagging variant of HA-LVM was added in RHEL4.5, and every version of RHEL5 and RHEL6.
- Redundant Ring Protocol (RRP) disables use of DLM, and therefore clvmd cannot be used with this configuration.
- This means that clvm-variant HA-LVM cannot be used with RRP clusters.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.