Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
2.4. Creating the Resources and Resource Groups with the pcs Command
This use case requires that you create four cluster resources. To ensure these resources all run on the same node, they are configured as part of the resource group
apachegroup. The resources to create are as follows, listed in the order in which they will start.
- An
LVMresource namedmy_lvmthat uses the LVM volume group you created in Section 2.1, “Configuring an LVM Volume with an ext4 File System”. - A
Filesystemresource namedmy_fs, that uses the file system device/dev/my_vg/my_lvyou created in Section 2.1, “Configuring an LVM Volume with an ext4 File System”. - An
IPaddr2resource, which is a floating IP address for theapachegroupresource group. The IP address must not be one already associated with a physical node. If theIPaddr2resource's NIC device is not specified, the floating IP must reside on the same network as the statically assigned IP addresses used by the cluster nodes, otherwise the NIC device to assign the floating IP address cannot be properly detected. - An
apacheresource namedWebsitethat uses theindex.htmlfile and the Apache configuration you defined in Section 2.2, “Web Server Configuration”.
The following procedure creates the resource group
apachegroup and the resources that the group contains. 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
my_lvm. This command specifies theexclusive=trueparameter to ensure that only the cluster is capable of activating the LVM logical volume. Because the resource groupapachegroupdoes not yet exist, this command creates the resource group.pcs resource create my_lvm LVM volgrpname=my_vg \ exclusive=true --group apachegroup
[root@z1 ~]# pcs resource create my_lvm LVM volgrpname=my_vg \ exclusive=true --group apachegroupCopy to Clipboard Copied! Toggle word wrap Toggle overflow When you create a resource, the resource is started automatically. You can use the following command to confirm that the resource was created and has started.pcs resource show
# pcs resource show Resource Group: apachegroup my_lvm (ocf::heartbeat:LVM): StartedCopy to Clipboard Copied! Toggle word wrap Toggle overflow You can manually stop and start an individual resource with thepcs resource disableandpcs resource enablecommands. - The following commands create the remaining resources for the configuration, adding them to the existing resource group
apachegroup.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - After creating the resources and the resource group that contains them, you can check the status of the cluster. Note that all four resources are running on the same node.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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. - Once the cluster is up and running, you can point a browser to the IP address you defined as the
IPaddr2resource to view the sample display, consisting of the simple word "Hello".Hello
HelloCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you find that the resources you configured are not running, you can run thepcs resource debug-start resourcecommand to test the resource configuration. For information on thepcs resource debug-startcommand, see the High Availability Add-On Reference manual.