Configuring Resource Constraints

Having all the resources configured is only part of the job. Even if the cluster knows all needed resources, it might still not be able to handle them correctly. Resource constraints let you specify which cluster nodes resources can run on, what order resources will load, and what other resources a specific resource is dependent on.

There are three different kinds of constraints available:

Resource Location

Locational constraints that define on which nodes a resource may be run, may not be run or is preferred to be run.

Resource Collocation

Collocational constraints that tell the cluster which resources may or may not run together on a node.

Resource Order

Ordering constraints to define the sequence of actions.

When defining constraints, you also need to deal with scores. Scores of all kinds are integral to how the cluster works. Practically everything from migrating a resource to deciding which resource to stop in a degraded cluster is achieved by manipulating scores in some way. Scores are calculated on a per-resource basis and any node with a negative score for a resource cannot run that resource. After calculating the scores for a resource, the cluster then chooses the node with the highest one. INFINITY is currently defined as 1,000,000. Additions or subtractions with it follows the following 3 basic rules:

When defining resource constraints, you also specify a score for each constraint. The score indicates the value you are assigning to this resource constraint. Constraints with higher scores are applied before those with lower scores. By creating additional location constraints with different scores for a given resource, you can specify an order for the nodes that a resource will fail over to.

Procedure 4.4. Adding or Modifying Locational Constraints

  1. Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.

  2. In the Linux HA Management Client main window, click Constraints in the left pane to see the constraints already configured for the cluster.

  3. In the left pane, select Constraints and click Add.

  4. Select Resource Location and click OK.

  5. Enter a unique ID for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.

  6. Select the Resource for which to define the constraint. The list shows the IDs of all resources that have been configured for the cluster.

  7. Set the Score for the constraint. Positive values indicate the resource can run on the Node you specify below. Negative values indicate the resource can not run on this node. Values of +/- INFINITY change “can” to must.

  8. Select the Node for the constraint.

  9. If you leave the Node and the Score field empty, you can also add rules by clicking Add+Rule. To add a lifetime, just click Add+Lifetime.

  10. If all parameters are set according to your wishes, click OK to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.

Procedure 4.5. Adding or Modifying Collocational Constraints

  1. Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.

  2. In the Linux HA Management Client main window, click Constraints in the left pane to see the constraints already configured for the cluster.

  3. In the left pane, select Constraints and click Add.

  4. Select Resource Collocation and click OK.

  5. Enter a unique ID for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.

  6. Select the Resource which is the collocation source. The list shows the IDs of all resources that have been configured for the cluster.

    If the constraint cannot be satisfied, the cluster may decide not to allow the resource to run at all.

  7. If you leave both the Resource and the With Resource field empty, you can also add a resource set by clicking Add+Resource Set. To add a lifetime, just click Add+Lifetime.

  8. In With Resource, define the collocation target. The cluster will decide where to put this resource first and then decide where to put the resource in the Resource field.

  9. Define a Score to determine the location relationship between both resources. Positive values indicate the resources should run on the same node. Negative values indicate the resources should not run on the same node. Values of +/- INFINITY change should to must. The score will be combined with other factors to decide where to put the node.

  10. If needed, specify further parameters, like Resource Role.

    Depending on the parameters and options you choose, a short Description explains the effect of the collocational constraint you are configuring.

  11. If all parameters are set according to your wishes, click OK to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.

Procedure 4.6. Adding or Modifying Ordering Constraints

  1. Start the Linux HA Management Client and log in to the cluster as described in Section 4.1, “Linux HA Management Client”.

  2. In the Linux HA Management Client main window, click Constraints in the left pane to see the constraints already configured for the cluster.

  3. In the left pane, select Constraints and click Add.

  4. Select Resource Order and click OK.

  5. Enter a unique ID for the constraint. When modifying existing constraints, the ID is already defined and is displayed in the configuration dialog.

  6. With First, define the resource that must be started before the Then resource is allowed to.

  7. With Then define the resource that will start after the First resource.

  8. If needed, define further parameters, for example Score (if greater than zero, the constraint is mandatory; otherwise it is only a suggestion) or Symmetrical (if true, stop the resources in the reverse order).

    Depending on the parameters and options you choose, a short Description explains the effect of the ordering constraint you are configuring.

  9. If all parameters are set according to your wishes, click OK to finish the configuration of the constraint. The configuration dialog is closed and the main window shows the newly added or modified constraint.

You can access and modify all constraints that you have configured in the Constraints view of the Linux HA Management Client.

Figure 4.3. Linux HA Management Client - Constraints

Linux HA Management Client - Constraints

For more information on configuring constraints and detailed background information about the basic concepts of ordering and collocation, refer to the following documents available at http://clusterlabs.org/wiki/Documentation: