Ce contenu n'est pas disponible dans la langue sélectionnée.
6.5. Resource Groups
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 [resource_id] ... [resource_id] [--before resource_id | --after resource_id]
You can use the
--before
and --after
options of this command to specify the position of the added resources relative to a resource that already exists in the group.
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 IPaddr
and Email
.
# 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, thenEmail
). - Resources are stopped in the reverse order in which you specify them. (
Email
first, thenIPaddr
).
If a resource in the group cannot run anywhere, then no resource specified after that resource is allowed to run.
- If
IPaddr
cannot run anywhere, neither canEmail
. - If
Email
cannot run anywhere, however, this does not affectIPaddr
in any way.
Obviously as the group grows bigger, the reduced configuration effort of creating resource groups can become significant.
6.5.1. Group Options
A resource group inherits the following options from the resources that it contains:
priority
, target-role
, is-managed
. For information on resource options, see Table 6.3, “Resource Meta Options”.
6.5.2. Group Stickiness
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.