8.5.2. Adding a Cluster Service to the Cluster
To add a cluster service to the cluster, follow the steps in this section.
Note
The examples provided in this section show a cluster service in which all of the resources are at the same level. For information on defining a service in which there is a dependency chain in a resource hierarchy, as well as the rules that govern the behavior of parent and child resources, see Appendix C, HA Resource Behavior.
- Open
/etc/cluster/cluster.confat any node in the cluster. - Add a
servicesection within thermelement for each service. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Configure the following parameters (attributes) in the
serviceelement:autostart— Specifies whether to autostart the service when the cluster starts. Use '1' to enable and '0' to disable; the default is enabled.domain— Specifies a failover domain (if required).exclusive— Specifies a policy wherein the service only runs on nodes that have no other services running on them.recovery— Specifies a recovery policy for the service. The options are to relocate, restart, disable, or restart-disable the service.
- Depending on the type of resources you want to use, populate the service with global or service-specific resourcesFor example, here is an Apache service that uses global resources:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example, here is an Apache service that uses service-specific resources:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 8.10, “cluster.confwith Services Added: One Using Global Resources and One Using Service-Specific Resources ” shows an example of acluster.conffile with two services:example_apache— This service uses global resourcesweb_fs,127.143.131.100, andexample_server.example_apache2— This service uses service-specific resourcesweb_fs2,127.143.131.101, andexample_server2.
- Update the
config_versionattribute by incrementing its value (for example, changing fromconfig_version="2"toconfig_version="3">). - Save
/etc/cluster/cluster.conf. - (Optional) Validate the updated file against the cluster schema (
cluster.rng) by running theccs_config_validatecommand. For example:ccs_config_validate
[root@example-01 ~]# ccs_config_validate Configuration validatesCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the
cman_tool version -rcommand to propagate the configuration to the rest of the cluster nodes. - Verify that the updated configuration file has been propagated.
- Proceed to Section 8.9, “Verifying a Configuration”.
Example 8.10. cluster.conf with Services Added: One Using Global Resources and One Using Service-Specific Resources