• No results found

Note: Availability of Templates

6.3.5 Configuring Resource Constraints

After you have configured all resources, specify how the cluster should handle them correctly.

Resource constraints let you specify on which cluster nodes resources can run, in which order resources will be loaded, and what other resources a specific resource depends on.

For an overview of available types of constraints, refer to Section 5.4.1, “Types of Constraints”. When defining constraints, you also need to specify scores. For more information on scores and their implications in the cluster, see Section 5.4.2, “Scores and Infinity”.

Learn how to create the different types of constraints in the following procedures.

PROCEDURE 6.9: ADDING OR MODIFYING LOCATION CONSTRAINTS

For location constraints, specify a constraint ID, resource, score and node:

1. Start a Web browser and log in to the cluster as described in Section 6.1.1, “Starting Hawk and Logging In”.

2. In the left navigation bar, select Constraints. The Constraints screen shows categories for all types of constraints. It lists all defined constraints.

3. To add a new Location constraint, click the plus icon in the respective category.

To modify an existing constraint, click the wrench icon next to the constraint and select Edit Constraint.

4. Enter a unique Constraint ID. When modifying existing constraints, the ID is already defined.

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

6. Set the Score for the constraint. Positive values indicate the resource can run on the Node you specify in the next step. Negative values mean it should not run on that node. Setting the score to INFINITY forces the resource to run on the node. Setting it to -INFINITY means the resources must not run on the node.

116 Configuring Resource Constraints SLE HA 12 SP1 7. Select the Node for the constraint.

8. Click Create Constraint to finish the configuration. A message at the top of the screen shows if the constraint was successfully created.

FIGURE 6.7: HAWK—LOCATION CONSTRAINT

PROCEDURE 6.10: ADDING OR MODIFYING COLOCATIONAL OR ORDER CONSTRAINTS

For both types of constraints specify a constraint ID and a score, then add resources to a dependency chain:

1. Start a Web browser and log in to the cluster as described in Section 6.1.1, “Starting Hawk and Logging In”.

2. In the left navigation bar, select Constraints. The Constraints screen shows categories for all types of constraints and lists all defined constraints.

3. To add a new Colocation or Order constraint, click the plus icon in the respective category.

To modify an existing constraint, click the wrench icon next to the constraint and select Edit Constraint.

4. Enter a unique Constraint ID. When modifying existing constraints, the ID is already defined.

5. Define a Score.

117 Configuring Resource Constraints SLE HA 12 SP1

For colocation constraints, the score determines the location relationship between the resources. Positive values indicate the resources should run on the same node. Negative values indicate the resources should not run on the same node. Setting the score to INFINITY forces the resources to run on the same node. Setting it to -INFINITY means the resources must not run on the same node. The score will be combined with other factors to decide where to put the resource.

For order constraints, the constraint is mandatory if the score is greater than zero, otherwise it is only a suggestion. The default value is INFINITY.

6. For order constraints, you can usually keep the option Symmetrical enabled. This specifies that resources are stopped in reverse order.

7. To define the resources for the constraint, follow these steps:

a. Select a resource from the list Add resource to constraint. The list shows the IDs of all resources and all resource templates configured for the cluster.

b. To add the selected resource, click the plus icon next to the list. A new list appears beneath. Select the next resource from the list. As both colocation and order constraints define a dependency between resources, you need at least two resources.

c. Select one of the remaining resources from the list Add resource to constraint. Click the plus icon to add the resource.

Now you have two resources in a dependency chain.

If you have defined an order constraint, the topmost resource will start first, then the second etc. Usually the resources will be stopped in reverse order.

However, if you have defined a colocation constraint, the arrow icons between the resources reflect their dependency, but not their start order. As the topmost resource depends on the next resource and so on, the cluster will first decide where to put the last resource, then place the depending ones based on that decision. If the constraint cannot be satisfied, the cluster may decide not to allow the dependent resource to run.

d. Add as many resources as needed for your colocation or order constraint.

e. If you want to swap the order of two resources, click the double arrow at the right hand side of the resources to swap the resources in the dependency chain.

8. If needed, specify further parameters for each resource, like the role (Master, Slave, Started, or Stopped).

118 Configuring Resource Constraints SLE HA 12 SP1 9. Click Create Constraint to finish the configuration. A message at the top of the screen shows

if the constraint was successfully created.

FIGURE 6.8: HAWK—COLOCATION CONSTRAINT

As an alternative format for defining constraints, you can use resource sets. They have the same ordering semantics as groups.

As of SUSE Linux Enterprise High Availability Extension 12, it is now also possible to use resource sets within location constraints. Formerly, they could only be used within colocation and ordering constraints.

PROCEDURE 6.11: USING RESOURCE SETS FOR CONSTRAINTS

1. Start a Web browser and log in to the cluster as described in Section 6.1.1, “Starting Hawk and Logging In”.

2. To use a resource set within a location constraint:

a. Proceed as outlined in Procedure 6.9, “Adding or Modifying Location Constraints” from Step 1 to Step 5.

b. Instead of only selecting a single resource, you can select multiple resources by pressing Ctrl or Shift in addition to the mouse click. This creates a resource set within the location constraint.

119 Configuring Resource Constraints SLE HA 12 SP1 c. Continue by entering a Score and by selecting a Node for the constraint.

d. To remove a resource from the location constraint, press Ctrl and click the resource again to deselect it. If you are editing an existing location constraint, click Apply Changes to confirm your choice.

3. To use a resource set within a colocation or order constraint:

a. Proceed as described in Procedure  6.10, “Adding or Modifying Colocational or Order Constraints”.

b. When you have added the resources to the dependency chain, you can put them into a resource set by clicking the chain icon at the right hand side. A resource set is visualized by a frame around the resources belonging to a set.

c. You can also add multiple resources to a resource set or create multiple resource sets.

d. To extract a resource from a resource set, click the scissors icon above the respective resource.

FIGURE 6.9: HAWK—REMOVING A RESOURCE FROM A SET

The resource will be removed from the set and put back into the dependency chain at its original place.

4. Confirm your changes to finish the constraint configuration.

120 Specifying Resource Failover Nodes SLE HA 12 SP1

For more information on configuring constraints and detailed background information about the basic concepts of ordering and colocation, refer to the documentation available at http://

www.clusterlabs.org/doc/:

Pacemaker Explained, chapter Resource Constraints Colocation Explained

Ordering Explained

PROCEDURE 6.12: REMOVING CONSTRAINTS

1. Start a Web browser and log in to the cluster as described in Section 6.1.1, “Starting Hawk and Logging In”.

2. In the left navigation bar, select Constraints. The Constraints screen shows categories for all types of constraints and lists all defined constraints.

3. Click the wrench icon next to a constraint and select Remove Constraint.