Language and Page Formatting Options
6.10. Adding a Cluster Service to the Cluster
To configure a cluster service in a cluster, perform the following steps:
- Add a service to the cluster with the following command:
ccs -h host --addservice servicename [service options]
NoteUse a descriptive name that clearly distinguishes the service from other services in the cluster.When you add a service to the cluster configuration, you configure the following attributes:
For example, to add a service to the configuration file on the cluster node
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. The restart recovery policy indicates that the system should attempt to restart the failed service before trying to relocate the service to another node. The relocate policy indicates that the system should try to restart the service in a different node. The disable policy indicates that the system should disable the resource group if any component fails. The restart-disable policy indicates that the system should attempt to restart the service in place if it fails, but if restarting the service fails the service will be disabled instead of being moved to another host in the cluster.If you select Restart or Restart-Disable as the recovery policy for the service, you can specify the maximum number of restart failures before relocating or disabling the service, and you can specify the length of time in seconds after which to forget a restart.
example_apachethat uses the failover domain
example_pri, and that has recovery policy of
relocate, execute the following command:
ccs -h node-01.example.com --addservice example_apache domain=example_pri recovery=relocateWhen configuring services for a cluster, you may find it useful to see a listing of available services for your cluster and the options available for each service. For information on using the
ccscommand to print a list of available services and their options, see Section 6.11, “Listing Available Cluster Services and Resources”.
- Add resources to the service with the following command:
ccs -h host --addsubservice servicename subservice [service options]Depending on the type of resources you want to use, populate the service with global or service-specific resources. To add a global resource, use the
--addsubserviceoption of the
ccsto add a resource. For example, to add the global file system resource named
web_fsto the service named
example_apacheon the cluster configuration file on
node-01.example.com, execute the following command:
ccs -h node01.example.com --addsubservice example_apache fs ref=web_fsTo add a service-specific resource to the service, you need to specify all of the service options. For example, if you had not previously defined
web_fsas a global service, you could add it as a service-specific resource with the following command:
ccs -h node01.example.com --addsubservice example_apache fs name=web_fs device=/dev/sdd2 mountpoint=/var/www fstype=ext3
- To add a child service to the service, you also use the
--addsubserviceoption of the
ccscommand, specifying the service options.If you need to add services within a tree structure of dependencies, use a colon (":") to separate elements and brackets to identify subservices of the same type. The following example adds a third
nfsclientservice as a subservice of an
nfsclientservice which is in itself a subservice of an
nfsclientservice which is a subservice of a service named
ccs -h node01.example.com --addsubservice service_a nfsclient:nfsclient:nfsclient
NoteIf you are adding a Samba-service resource, add it directly to the service, not as a child of another resource.
NoteWhen configuring a dependency tree for a cluster service that includes a floating IP address resource, you must configure the IP resource as the first entry.
To verify the existence of the IP service resource used in a cluster service, you can use the
/sbin/ip addr showcommand on a cluster node (rather than the obsoleted
ifconfigcommand). The following output shows the
/sbin/ip addr showcommand executed on a node running a cluster service:
1: lo: <LOOPBACK,UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP> mtu 1356 qdisc pfifo_fast qlen 1000 link/ether 00:05:5d:9a:d8:91 brd ff:ff:ff:ff:ff:ff inet 10.11.4.31/22 brd 10.11.7.255 scope global eth0 inet6 fe80::205:5dff:fe9a:d891/64 scope link inet 10.11.4.240/22 scope global secondary eth0 valid_lft forever preferred_lft forever
To remove a service and all of its subservices, execute the following command:
ccs -h host --rmservice servicename
To remove a subservice, execute the following command:
ccs -h host --rmsubservice servicename subservice [service options]
Note that when you have finished configuring all of the components of your cluster, you will need to sync the cluster configuration file to all of the nodes, as described in Section 6.15, “Propagating the Configuration File to the Cluster Nodes”.