Questo contenuto non è disponibile nella lingua selezionata.
Chapter 5. Configuring a GFS2 File System in a Cluster
The following procedure is an outline of the steps required to set up a Pacemaker cluster that includes a GFS2 file system.
After installing and starting the cluster software on all nodes, create the cluster. You must configure fencing for the cluster. For information on creating a Pacemaker cluster and configuring fencing for the cluster, see Creating a Red Hat High-Availability Cluster with Pacemaker in High Availability Add-On Administration. Once you have done this, perform the following procedure.
- On all nodes of the cluster, install the
lvm2-clusterandgfs2-utilspackages, which are part of the Resilient Storage channel.yum install lvm2-cluster gfs2-utils
# yum install lvm2-cluster gfs2-utilsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the global Pacemaker parameter
no_quorum_policytofreeze.Note
By default, the value ofno-quorum-policyis set tostop, indicating that once quorum is lost, all the resources on the remaining partition will immediately be stopped. Typically this default is the safest and most optimal option, but unlike most resources, GFS2 requires quorum to function. When quorum is lost both the applications using the GFS2 mounts and the GFS2 mount itself cannot be correctly stopped. Any attempts to stop these resources without quorum will fail which will ultimately result in the entire cluster being fenced every time quorum is lost.To address this situation, setno-quorum-policytofreezewhen GFS2 is in use. This means that when quorum is lost, the remaining partition will do nothing until quorum is regained.pcs property set no-quorum-policy=freeze
# pcs property set no-quorum-policy=freezeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up a
dlmresource. This is a required dependency forclvmdand GFS2.pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true
# pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Execute the following command in each node of the cluster to enable clustered locking. This command sets the
locking_typeparameter in the/etc/lvm/lvm.conffile to 3./sbin/lvmconf --enable-cluster
# /sbin/lvmconf --enable-clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up
clvmdas a cluster resource.pcs resource create clvmd ocf:heartbeat:clvm 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=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that theclvmdandcmirrorddeamons are started and managed by Pacemaker using theocf:heartbeat:clvmresource agent and do not need to be started during boot withsystemd. Additionally, theocf:heartbeat:clvmresource agent, as part of the start procedure, sets thelocking_typeparameter in the/etc/lvm/lvm.conffile to 3 and disables thelvmetaddaemon. - Set up
clvmdanddlmdependency and start up order.clvmdmust start afterdlmand must run on the same node asdlm.pcs constraint order start dlm-clone then clvmd-clone pcs constraint colocation add clvmd-clone with dlm-clone
# pcs constraint order start dlm-clone then clvmd-clone # pcs constraint colocation add clvmd-clone with dlm-cloneCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the clustered logical volume.
pvcreate /dev/vdb vgcreate -Ay -cy sasbin_vg /dev/vdb lvcreate -L5G -n sasbin_lv sasbin_vg
# pvcreate /dev/vdb # vgcreate -Ay -cy sasbin_vg /dev/vdb # lvcreate -L5G -n sasbin_lv sasbin_vgCopy to Clipboard Copied! Toggle word wrap Toggle overflow Warning
When you create volume groups with CLVM on shared storage, you must ensure that all nodes in the cluster have access to the physical volumes that constitute the volume group. Asymmetric cluster configurations in which some nodes have access to the storage and others do not are not supported.When managing volume groups using CLVMD to allow for concurrent activation of volumes across multiple nodes, the volume groups must have the clustered flag enabled. This flag allows CLVMD to identify the volumes it must manage, which is what enables CLVMD to maintain LVM metadata continuity. Failure to adhere to this configuration renders the configuration unsupported by Red Hat and may result in storage corruption and loss of data. - Format the logical volume with a GFS2 file system. One journal is required for each node that mounts the file system. Ensure that you create enough journals for each of the nodes in your cluster.
mkfs.gfs2 -j2 -p lock_dlm -t rhel7-demo:sasbin /dev/sasbin_vg/sasbin_lv
# mkfs.gfs2 -j2 -p lock_dlm -t rhel7-demo:sasbin /dev/sasbin_vg/sasbin_lvCopy to Clipboard Copied! Toggle word wrap Toggle overflow Warning
When you create the GFS2 filesystem, it is important to specify a correct value for the-t LockTableNameoption. The correct format is ClusterName:FSName. Failure to specify a correct value will prevent the filesystem from mounting. Additionally, the file system name must be unique. For more information on the options for themkfs.gfs2command, see Section 3.1, “Creating a GFS2 File System”. - Configure a
clusterfsresource.You should not add the file system to the/etc/fstabfile because it will be managed as a Pacemaker cluster resource. Mount options can be specified as part of the resource configuration withoptions=options. Run thepcs resource describe Filesystemcommand for full configuration options.This cluster resource creation command specifies thenoatimemount option, which is recommended for GFS2 file systems where the application allows it.In this example, the file system has the same name as the mount point. This is not a requirement, but it is recommended that the file system name relate to its actual use or mount point to help with troubleshooting should the file system encounter a problem.# pcs resource create clusterfs Filesystem device="/dev/sasbin_vg/sasbin_lv" directory="/usr/local/sasbin" fstype="gfs2" options="noatime" op monitor interval=10s on-fail=fence clone interleave=true
# # pcs resource create clusterfs Filesystem device="/dev/sasbin_vg/sasbin_lv" directory="/usr/local/sasbin" fstype="gfs2" options="noatime" op monitor interval=10s on-fail=fence clone interleave=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set up GFS2 and
clvmddependency and startup order. GFS2 must start afterclvmdand must run on the same node asclvmd.pcs constraint order start clvmd-clone then clusterfs-clone pcs constraint colocation add clusterfs-clone with clvmd-clone
# pcs constraint order start clvmd-clone then clusterfs-clone # pcs constraint colocation add clusterfs-clone with clvmd-cloneCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify that GFS2 is mounted as expected.
mount |grep sas
# mount |grep sas /dev/mapper/sasbin_vg-sasbin_lv on /usr/local/sasbin type gfs2 (rw,noatime,seclabel)Copy to Clipboard Copied! Toggle word wrap Toggle overflow