Cluster Setup:
2 Nodes with CentOS 7.x: clstr01-nd01, clstr01-nd02
Common storage array between both nodes (8 shared
volumes, presented as /dev/mapper/mpatha to
/dev/mapper/mpathh)
2 Port NICs, bonded (bond0) in each node
Resource group grp_xxx (nd01 preferred) -
Mount Point: /clstr01-xxx
Resource group grp_yyy (nd02 preferred) -
Mount Point: /clstr01-yyy
On both nodes:
--------------
Edit /etc/lvm/lvm.conf, and configure 'filter' and
'global_filter' parameters to scan only the required
(local and shared) devices.
Then run -
# /sbin/lvmconf --enable-cluster
Rebuild initramfs -
# mv /boot/initramfs-$(uname -r).img
/boot/initramfs-$(uname -r).img-orig
# dracut -H -f /boot/initramfs-$(uname -r).img $(uname
-r)
Reboot both nodes.
--------------
After rebooting both nodes, run the following commands
on any one node:
--------------
# pcs cluster start --all
# pcs resource create dlm ocf:pacemaker:controld op
monitor interval=30s on-fail=fence clone interleave=true
ordered=true
# 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
# pvcreate /dev/mapper/mpath{a,b,c,d,e,f,g,h}
# vgcreate -Ay -cy clstr_vg01
/dev/mapper/mpath{a,b,c,d,e,f,g,h}
# lvcreate -L 100T -n lv01 clstr_vg01
# mkfs.xfs /dev/clstr_vg01/lv01
# lvcreate -L 100T -n lv02 clstr_vg01
# mkfs.xfs /dev/clstr_vg01/lv02
# pcs resource create xxx_mount
ocf:heartbeat:Filesystem device=/dev/clstr_vg01/lv01
directory=/clstr01-xxx fstype=xfs --group xxx_grp
--disabled
# pcs resource create xxx_ip_01 ocf:heartbeat:IPaddr2
ip=172.16.0.101 cidr_netmask=24 nic=bond0:0 op monitor
interval=30s --group xxx_grp --disabled
# pcs constraint location xxx_grp prefers
clstr01-nd01=50
# pcs constraint order start clvmd-clone then xxx_grp
# pcs resource enable xxx_mount
# pcs resource enable xxx_ip_01
# pcs resource create yyy_mount
ocf:heartbeat:Filesystem device=/dev/clstr_vg01/lv02
directory=/clstr01-yyy fstype=xfs --group yyy_grp
--disabled
# pcs resource create yyy_ip_01 ocf:heartbeat:IPaddr2
ip=172.16.0.102 cidr_netmask=24 nic=bond0:1 op monitor
interval=30s --group yyy_grp --disabled
# pcs constraint location yyy_grp prefers
clstr01-nd02=50
# pcs constraint order start clvmd-clone then yyy_grp
# pcs resource enable yyy_mount
# pcs resource enable yyy_ip_01
--------------
# pcs resource show
--------------
-------------------------------------------------------------------------------------------------------------------------------------------------------