Cluster resources must be created for every resource or application you run on servers in your cluster. Cluster resources can include Web sites, e-mail servers, databases, file systems, virtual machines, and any other server-based applications or services you want to make available to users at all times.
Cluster resources can be created using either the graphical HA Management Client utility, or the CIBAdmin command line utility.
This section consists of the following subsections:
![]() | Note |
|---|---|
The Heartbeat installation creates a linux user named hacluster. Prior to creating cluster resources using the HA Management Client utility, you must set the password for the hacluster user. To do this, enter passwd hacluster at the command line and enter a password for the hacluster user. Do this on every node where you will run the HA Management Client utility. | |
Start the HA Management Client by entering hb_gui at the command line of a Linux server or workstation.
![]() |
Log in to the cluster by clicking , selecting , then providing the username and password.
If you are running the HA Management Client on a Heartbeat cluster server, the server and username fields should already be filled in. If not, specify the server IP address of a cluster server and hacluster as the username.
![]() |
Click Resources, then click Add New Item, or click the + button.
Choose the resource item type you want to create, then click OK.
The possible options are:
Native
Group
Place (Constraint)
Order (Constraint)
Colocation (Constraint)
All but the Native and Group resource item types are contraints. You must have a resource or group created in order to create a constraint and add that constraint to a resource.
Enter the resource name (ID) and if desired, choose a group to add the resource to.
Select the resource type from the list.
You can double-click any of the resource types in the list to display a brief description of that resource type.
(Conditional) After selecting a resource type, a line for that resource type might be added to the Parameters section of the screen. If a line is added, click the line once and then click the line again under the heading to open a field where you can add the needed value.
Add the needed value for the resource.
For example, if you selected an IP address as the resource type above, enter the IP address for the resource.
Click , specify the parameter name and value, then click .
![]() |
Click at the bottom of the screen to add the resource to the cluster.
Resource constraints let you specify which cluster nodes resources will run on, what order resources will load, and what other resources a specific resource is dependent on. For information on configuring resource constraints, see Constraints on the High Availability Linux Web site.
Cluster resources will automatically fail over to another node in the cluster in the event of a software or hardware failure. If you have more than two nodes in your cluster, the node a particular resource fails over to is chosen by the Heartbeat software. If you want to choose which node a resource will fail over to, you must configure a place or location constraint for that resource.
Start the HA Management Client by entering hb_gui at the command line.
Log in to the cluster by clicking , selecting , then providing the username and password.
The and fields should already be filled in.
Select the desired resource or group, select and then select , or click the + button.
Choose as the resource item type, then click .
Specify the name (ID) of the resource contraint and provide a score for it, then click .
The resource name for the resource you selected should already be displayed in the Resource field.
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 place constraints with different scores for a given resource, you can specify an order for the nodes that a resource will fail over to.
On the left side of the page, select the resource constraint you just created and click .
Select as the Attribute, as the Operation, and the servername of the failover node as the Value.
Click then click to save your changes.
(Conditional) If you want to specify additional failover nodes for a resource, create additional place contstraints by performing Step 1 through Step 8 for each constraint.
A resource will automatically fail back to its original node when that node is back online and in the cluster. If you want to prevent a resource from failing back to the node it was running on prior to a failover, or if you want to specify a different node for the resoure to fail back to, you must change its resource stickiness value. You can specify resource stickiness when you are creating a resource, or after.
To specify resource stickiness for a resource after it has been created:
Start the HA Management Client by entering hb_gui at the command line.
Log in to the cluster by clicking , selecting , then providing the username and password.
The and fields should already be filled in.
Select the desired resource or group, click the tab, then click .
In the field, type resource_stickiness.
In the field, specify a value between -100,000 and 100,000.
Consider the following when specifying a resource stickiness value:
Value is 0: This is the default. The resource will be placed optimally in the system. This may mean that it is moved when a "better" or less loaded node becomes available. This option is almost equivalent to automatic failback, except that the resource may be moved to a node other than the one it was previously active on.
Value is greater than 0: The resource will prefer to remain in its current location, but may be moved if a more suitable node is available. Higher values indicate a stronger preference for a resource to stay where it is.
Value is less than 0: The resource prefers to move away from its current location. Higher absolute values indicate a stronger preference for a resource to be moved.
Value is 100,000: The resource will always remain in its current location unless forced off because the node is no longer eligible to run the resource (node shutdown, node standby, or configuration change). This option is almost equivalent to completely disabling automatic failback, except that the resource may be moved to nodes other than the one it was previously active on.
Value is -100,000: The resource will always move away from its current location.
Although Heartbeat can detect a node failure, it also has the ability to detect when an individual resource on a node has failed. If you want Heartbeat to ensure that a resource is running, you must configure resource monitoring for that resource. Resource monitoring consists of specifying a timeout and/or start delay value, and an interval. The interval tells Heartbeat how often it should check the resource status.
To configure resource monitoring:
Using the HA Management Client (hb_gui), select the resource, click the tab, then click .
Select as the operation name.
Add the desired values in the , , and fields, and a description if desired.
Click then click to start the monitoring operation.
If you do not configure resource monitoring, resource failures after a successful start will not be communicated, and the cluster will always show the resource as healthy.
If the resource monitor detects a failure, the following actions will take place:
Log file messages will be generated
The failure will be reflected in the hb_gui and crm_mon tools, and in the CIB status section
The cluster will initiate noticeable recovery actions which may include stopping the resource to repair the failed state and restarting the resource locally or on another node. The resource also may not be restarted at all, depending on the configuration and state of the cluster.
Some cluster resources do not start automatically after being created. To start a new cluster resource after creating it, in the HA Management Client, select the resource in the left pane, then click .
You can remove a cluster resource using the HA Management Client. To do this, select the resource in the left pane, and click .
Some cluster resources are dependent on other components or resources, and require that each component or resource be started in a specific order and run together on the same server. An example of this is a Web server that requires an IP address and a file system. In this case each component is a separate cluster resource that is combined into a cluster resource group. The resource group would then run on a server or servers, and in case of a software or hardware malfunction, fail over to another server in the cluster the same as an individual cluster resource.
![]() | Note |
|---|---|
The recommended method is to add resources to a resource group when they (the resources) are created. If resources are added to a group after they are created, you might experience unexpected service outages. | |
To configure a resource group using the above example:
Start the HA Management Client by entering hb_gui at the command line.
Log in to the cluster by clicking , selecting , and then providing the username and password.
The and fields should already be filled in.
Click , then click , or click the + button.
Choose as the resource item type, then click .
Specify a Group name (ID), leave the default of True for both the and fields, then click .
The Ordered value specifies if the resources in the group will load in order you specify. The Collocated value specifies whether the resources in the group will run on the same server.
Specify a resource name (ID) for the IP address resource portion of the group.
In the section of the page, scroll down the list and select as the resource type.
In the section of the page, find the line that was added for the IP address resource, click the line once, then click the line again under the heading to open a text field.
Add the IP address for the IP address cluster resource.
Click the button, select as the name and enter eth0 as the value, then click .
The name and value are dependent on your hardware configuration and what you chose in Step 4.
Click the button at the bottom of the page to add the resource to the group.
Using the HA Management Client, click then click , or click the + button.
Choose as the resource item type, then click .
Specify a resource name (ID) for the file system resource, and in the field, select the group you created above.
In the section of the page, scroll down the list and select as the resource type.
In the section of the page, find the line that was added for the file system resource, click the line once, then click the line again under the heading to open a text field.
Add the name of the file system.
For example, Reiser.
Click the button and select device as the name and for the value, specify the device where the filesystem is located, then click .
The name and value are dependent on your hardware configuration. For example, you could specify /dev/sdc as the value if the file system is on that device.
Using the HA Management Client, click , then click , or click the + button.
Choose as the resource item type, then click .
Specify a resource name (ID) for the Web Server resource, and in the field, select the group you created above.
In the section of the page, scroll down the list and select Apache as the resource type.
In the Parameters section of the page, find the line that was added for the Apache Web server resource, accept or change the path to the Apache Web server, then click .
![]() | Note |
|---|---|
If you want to enable resource monitoring for a group resource, you must configure monitoring separately for each resource in the group that you want monitored. | |
You may want certain resources to run simultaneously on multiple nodes in your cluster. To do this you must configure a resource as a clone. Examples of resources that might be configured as clones include STONITH and cluster file systems like OCFS2. You can clone any resource provided it is supported by the resource’s ResourceAgent. Clone resources may even be configured differently depending on which nodes they are hosted.
There are three types of resource clones:
Anonymous Clones: These are the simplest type of clones. They behave identically everywhere they are running.
Globally Unique Clones: These resources are distinct entities. An instance of the clone running on one node is not equivalent to another instance on another node; nor would any two instances on the same node be equivalent.
Stateful Clones: Active instances of these resources are divided into two states, active and passive. These are also sometimes referred to as primary and secondary, or master and slave. Stateful clones can be either anonymous or globally unique.
To configure a resource as a clone, follow Step 1 through Step 7 in Section 4.1.1, “Creating Cluster Resources Using the HA Management Client” and then
Select the Clone checkbox.
This will allow the resource to simultaneously run on multiple cluster nodes.
In the field, enter the number of instances of the resource that will run on a given node.
In the field, enter the number of nodes in the cluster that will run the resource.
Click Add to add the clone resource to the cluster.
Select the resource in the left pane and click Resource > Start to start the resource.
After creating the resource, you must create location constraints for the resource. The location constraints determine which nodes the resource can run on. See Constraints on the High Availability Linux Web site.
Starting the clone resource will cause it to start on the nodes that have been specified with its resource location contraints.