Configuring LVM Volumes in a Cluster

HA-LVM Volumes

RHEL 7.8 - lvm2-2.02.186-7.el7.x86_64

# Enable HA-LVM.
lvmconf --enable-halvm --services --startstopservices
systemctl mask lvm2-lvmetad.socket # A known issue, starts on boot even after it's disabled.

# Configure a volume_list that only contains local volume groups, like volume_list = [ "rhel" ]
vim /etc/lvm/lvm.conf

# Rebuild initramfs.
dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
reboot

# Create the HA-LVM resources.
pcs resource create halvm LVM volgrpname=vgcluster exclusive=true --group halvmfs

a. Sets the global/locking_type = 1 and global/use_lvmetad = 0 in /etc/lvm/lvm.conf.
b. Disables the lvmetad daemon.

CLVM Volumes

RHEL 7.8 - lvm2-2.02.186-7.el7.x86_64

yum -y install lvm2-cluster dlm
lvmconf --enable-cluster # locking_type=3, use_lvmetad=0
systemctl mask lvm2-lvmetad.socket # A known issue, starts on boot even after it's disabled.

pcs cluster cib dlm_cfg
pcs -f dlm_cfg resource create dlm ocf:pacemaker:controld op monitor interval=60s
pcs -f dlm_cfg resource clone dlm clone-max=2 clone-node-max=1
pcs cluster cib-push dlm_cfg

pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s \
on-fail=fence clone interleave=true ordered=true

pcs constraint order start dlm-clone then clvmd-clone
pcs constraint colocation add clvmd-clone with dlm-clone

a. Sets the global/locking_type = 3 and global/use_lvmetad = 0 in /etc/lvm/lvm.conf.
b. Disables the lvmetad daemon.