Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
3.5. Configuring the Cluster Resources
This section provides the procedure for configuring the cluster resources for this use case.
Note
It is recommended that when you create a cluster resource with the
pcs resource create, you execute the pcs status command immediately afterwards to verify that the resource is running. Note that if you have not configured a fencing device for your cluster, as described in Section 1.3, “Fencing Configuration”, by default the resources do not start.
If you find that the resources you configured are not running, you can run the
pcs resource debug-start resource command to test the resource configuration. This starts the service outside of the cluster’s control and knowledge. At the point the configured resources are running again, run pcs resource cleanup resource to make the cluster aware of the updates. For information on the pcs resource debug-start command, see the High Availability Add-On Reference manual.
The following procedure configures the system resources. To ensure these resources all run on the same node, they are configured as part of the resource group
nfsgroup. The resources will start in the order in which you add them to the group, and they will stop in the reverse order in which they are added to the group. Run this procedure from one node of the cluster only.
- The following command creates the LVM resource named
my_lvm. This command specifies theexclusive=trueparameter to ensure that only the cluster is capable of activating the LVM logical volume. Because the resource groupnfsgroupdoes not yet exist, this command creates the resource group.pcs resource create my_lvm LVM volgrpname=my_vg \ exclusive=true --group nfsgroup
[root@z1 ~]# pcs resource create my_lvm LVM volgrpname=my_vg \ exclusive=true --group nfsgroupCopy to Clipboard Copied! Toggle word wrap Toggle overflow Check the status of the cluster to verify that the resource is running.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure a
Filesystemresource for the cluster.Note
You can specify mount options as part of the resource configuration for aFilesystemresource with theoptions=optionsparameter. Run thepcs resource describe Filesystemcommand for full configuration options.The following command configures an ext4Filesystemresource namednfsshareas part of thenfsgroupresource group. This file system uses the LVM volume group and ext4 file system you created in Section 3.2, “Configuring an LVM Volume with an ext4 File System” and will be mounted on the/nfssharedirectory you created in Section 3.3, “NFS Share Setup”.pcs resource create nfsshare Filesystem \ device=/dev/my_vg/my_lv directory=/nfsshare \ fstype=ext4 --group nfsgroup
[root@z1 ~]# pcs resource create nfsshare Filesystem \ device=/dev/my_vg/my_lv directory=/nfsshare \ fstype=ext4 --group nfsgroupCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that themy_lvmandnfsshareresources are running.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the
nfsserverresource namednfs-daemonpart of the resource groupnfsgroup.Note
Thenfsserverresource allows you to specify annfs_shared_infodirparameter, which is a directory that NFS daemons will use to store NFS-related stateful information. It is recommended that this attribute be set to a subdirectory of one of theFilesystemresources you created in this collection of exports. This ensures that the NFS daemons are storing their stateful information on a device that will become available to another node if this resource group should need to relocate. In this example,/nfsshareis the shared-storage directory managed by theFilesystemresource,/nfsshare/exports/export1and/nfsshare/exports/export2are the export directories, and/nfsshare/nfsinfois the shared-information directory for thenfsserverresource.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the
exportfsresources to export the/nfsshare/exportsdirectory. These resources are part of the resource groupnfsgroup. This builds a virtual directory for NFSv4 clients. NFSv3 clients can access these exports as well.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add the floating IP address resource that NFS clients will use to access the NFS share. The floating IP address that you specify requires a reverse DNS lookup or it must be specified in the
/etc/hostson all nodes in the cluster. This resource is part of the resource groupnfsgroup. For this example deployment, we are using 192.168.122.200 as the floating IP address.pcs resource create nfs_ip IPaddr2 \ ip=192.168.122.200 cidr_netmask=24 --group nfsgroup
[root@z1 ~]# pcs resource create nfs_ip IPaddr2 \ ip=192.168.122.200 cidr_netmask=24 --group nfsgroupCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add an
nfsnotifyresource for sending NFSv3 reboot notifications once the entire NFS deployment has initialized. This resource is part of the resource groupnfsgroup.Note
For the NFS notification to be processed correctly, the floating IP address must have a host name associated with it that is consistent on both the NFS servers and the NFS client.pcs resource create nfs-notify nfsnotify \ source_host=192.168.122.200 --group nfsgroup
[root@z1 ~]# pcs resource create nfs-notify nfsnotify \ source_host=192.168.122.200 --group nfsgroupCopy to Clipboard Copied! Toggle word wrap Toggle overflow
After creating the resources and the resource constraints, you can check the status of the cluster. Note that all resources are running on the same node.