Ce contenu n'est pas disponible dans la langue sélectionnée.
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-cluster
andgfs2-utils
packages, which are part of the Resilient Storage channel.#
yum install lvm2-cluster gfs2-utils
- Set the global Pacemaker parameter
no_quorum_policy
tofreeze
.Note
By default, the value ofno-quorum-policy
is 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-policy
tofreeze
when 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
- Set up a
dlm
resource. This is a required dependency forclvmd
and GFS2.#
pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true
- Execute the following command in each node of the cluster to enable clustered locking. This command sets the
locking_type
parameter in the/etc/lvm/lvm.conf
file to 3.#
/sbin/lvmconf --enable-cluster
- Set up
clvmd
as a cluster resource.#
pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=true
Note that theclvmd
andcmirrord
deamons are started and managed by Pacemaker using theocf:heartbeat:clvm
resource agent and do not need to be started during boot withsystemd
. Additionally, theocf:heartbeat:clvm
resource agent, as part of the start procedure, sets thelocking_type
parameter in the/etc/lvm/lvm.conf
file to 3 and disables thelvmetad
daemon. - Set up
clvmd
anddlm
dependency and start up order.clvmd
must start afterdlm
and 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
- Create the clustered logical volume.
#
pvcreate /dev/vdb
#vgcreate -Ay -cy sasbin_vg /dev/vdb
#lvcreate -L5G -n sasbin_lv sasbin_vg
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
Warning
When you create the GFS2 filesystem, it is important to specify a correct value for the-t LockTableName
option. 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.gfs2
command, see Section 3.1, “Creating a GFS2 File System”. - Configure a
clusterfs
resource.You should not add the file system to the/etc/fstab
file 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 Filesystem
command for full configuration options.This cluster resource creation command specifies thenoatime
mount 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
- Set up GFS2 and
clvmd
dependency and startup order. GFS2 must start afterclvmd
and 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
- Verify that GFS2 is mounted as expected.
#
mount |grep sas
/dev/mapper/sasbin_vg-sasbin_lv on /usr/local/sasbin type gfs2 (rw,noatime,seclabel)