One of the most common elements of a cluster is a set of resources that need to be located together, start sequentially, and stop in the reverse order. To simplify this configuration, Pacemaker supports the concept of groups.
You create a resource group with the following command, specifying the resources to include in the group. If the group does not exist, this command creates the group. If the group exists, this command adds additional resources to the group. The resources will start in the order you specify them with this command, and will stop in the reverse order of their starting order.
pcs resource group add group_name resource_id...
You can also add a new resource to an existing group when you create the resource, using the following command. The resource you create is added to the group named group_name.
pcs resource create resource_id standard:provider:type|type [resource_options] [op operation_action operation_options] --group group_name
You remove a resource from a group with the following command. If there are no resources in the group, this command removes the group itself.
pcs resource group remove group_name resource_id...
The following command lists all currently configured resource groups.
pcs resource group list
The following example creates a resource group named
shortcut that contains the existing resources
pcs resource group add shortcut IPaddr Email
There is no limit to the number of resources a group can contain. The fundamental properties of a group are as follows.
Resources are started in the order in which you specify them (in this example,
IPaddr first, then
Resources are stopped in the reverse order in which you specify them. (
Email first, then
If a resource in the group cannot run anywhere, then no resource specified after that resource is allowed to run.
IPaddr cannot run anywhere, neither can
Email cannot run anywhere, however, this does not affect
IPaddr in any way.
Obviously as the group grows bigger, the reduced configuration effort of creating resource groups can become significant.
A resource group inherits the following options from the resources that it contains:
For information on resource options, see Table 5.3, “Resource Meta Options”
Stickiness, the measure of how much a resource wants to stay where it is, is additive in groups. Every active resource of the group will contribute its stickiness value to the group’s total. So if the default
resource-stickiness is 100, and a group has seven members, five of which are active, then the group as a whole will prefer its current location with a score of 500.