Contents
Abstract
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.
You can either use the graphical HA Management Client utility, or the
cibadmin command line utility to create resources.
This chapter introduces the graphical HA Management Client and then covers several topics you need when configuring a cluster: creating resources, configuring constraints, specifying failover nodes and failback nodes, configuring resource monitoring, starting or removing resources, configuring resource groups or clone resources, and migrating resources manually.
When starting the Heartbeat GUI, you need to connect to a cluster.
![]() | Password for the hacluster User |
|---|---|
The Heartbeat installation creates a linux user named
Do this on every node where you will run the HA Management Client utility. | |
To start the HA Management Client, enter hb_gui at the command line of a Linux server or workstation. Log in to the cluster by selecting +. You are prompted for a 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.
After being connected, your main window shows the cluster components, resources and constraints:
![]() |
Depending on which entry you select in the left pane, several tabs appear in the right pane of the main window. For example, if you select the topmost entry, , you can access three tabs on the right in the main window, allowing you to view general on the cluster or to change certain options and aspects on the and tabs.
In the following, find some examples how to create and manage cluster resources with the HA Management Client.
To add a cluster resource:
Start the HA Management Client and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
Select +, or click the button.
Choose the resource item type you want to create, then click .
The possible options are:
Native
Group
Location (Constraint)
Order (Constraint)
Colocation (Constraint)
All but the and resource item types are constraints. You must have a resource or group created in order to create a constraint and add that constraint to a resource.
Enter the Resource ID (name) and if desired, choose a group to add the resource to.
Select the resource from the list. To display a brief description of that resource type, double-click any of the resource types in the list.
Conditional: After selecting a resource type, a line for that resource type might be added to the 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 and , 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 http://www.linux-ha.org/ClusterInformationBase/SimpleExamples.
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 location constraint for that resource.
Start the HA Management Client and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
Select the desired resource or group, select +, or click the button.
Choose as the resource item type, then click .
Specify the of the resource constraint. The resource name for the resource you selected should already be displayed in the field.
Click to add the constraint. The score will
automatically be set to 0 by default to avoid unwanted
effects caused by an incomplete rule.
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.
If you need to modify the score, select the added constraint in the left pane of the main window and enter a new value in the section in the right pane.
On the left side of the page, select the resource constraint you just created and click .
Select as the , as the , and the server name of the failover node as the .
Click then click to save your changes.
Conditional: If you want to specify additional failover nodes for a resource, create additional location constraints by performing Step 1 through Step 9 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 resource 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 and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
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:
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 that is not the one it was previously active on.
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.
0:The resource prefers to move away from its current location. Higher absolute values indicate a stronger preference for a resource to be moved.
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 other nodes than the one it was previously active on.
-100,000:The resource will always move away from its current location.
See also the crm_failcount command: crm_failcount(8).
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:
Start the HA Management Client and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
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 are 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.
To configure a resource group using the above example:
Start the HA Management Client and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
Select +, 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 value specifies, if the resources in the group will load in order you specified. The 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 3.
Click the button at the bottom of the page to add the resource to the group.
Using the HA Management Client, select and then select , 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 as the name. For the value, specify the device where the file system 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, select and then select , 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 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 .
![]() | |
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 anywhere 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 6 in Section 4.2, “Creating Cluster Resources”.
Select the check box. 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 to add the clone resource to the cluster.
Select the resource in the left pane and click + to start the resource. Starting the clone resource will cause it to start on the nodes that have been specified with its resource location constraints.
After creating the resource, you must create location constraints for the resource. The location constraints determine which nodes the resource can run on. For information on configuring resource constraints, see http://www.linux-ha.org/ClusterInformationBase/SimpleExamples.
Although resources are configured to automatically fail over (or migrate) to other nodes in the cluster in the even of a hardware or software failure, you can also manually migrate a resource to another node in the cluster using either the HA Management Client or the command line.
At the command line, use the following command:
crm_resource -M -rresource_name-Hhostname-f
For example, to migrate a resource named ipaddress1 to a
cluster node named node2, you would need to
enter:
crm_resource -M -r ipaddress1 -H node2 -f
To get a list of parameters and switches that can be used with the crm_resource command, enter crm_resource without any options.
To use the HA Management Client for migration, start the HA Management Client and log in to the cluster as described in Section 4.1, “Graphical HA Management Client”.
Select the resource you want to migrate in the left pane of the main window and select +.
In the new window, select ipaddress1 as
to migrate and select
node1 from the
drop-down list.