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: Note Use 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: 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. For example, to add a service to the configuration file on the cluster node node-01.example.com named example_apache that uses the failover domain example_pri , and that has recovery policy of relocate , execute the following command: When 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 ccs command 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: 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 --addsubservice option of the ccs to add a resource. For example, to add the global file system resource named web_fs to the service named example_apache on the cluster configuration file on node-01.example.com , execute the following command: To 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_fs as a global service, you could add it as a service-specific resource with the following command: To add a child service to the service, you also use the --addsubservice option of the ccs command, 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 nfsclient service as a subservice of an nfsclient service which is in itself a subservice of an nfsclient service which is a subservice of a service named service_a : Note If you are adding a Samba-service resource, add it directly to the service, not as a child of another resource. Note When 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. Note To verify the existence of the IP service resource used in a cluster service, you can use the /sbin/ip addr show command on a cluster node (rather than the obsoleted ifconfig command). The following output shows the /sbin/ip addr show command executed on a node running a cluster service: To remove a service and all of its subservices, execute the following command: To remove a subservice, execute the following command: 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" .

Commands:
ccs -h host --addservice servicename [service options]
ccs -h node-01.example.com --addservice example_apache domain=example_pri recovery=relocate
ccs -h host --addsubservice servicename subservice [service options]
ccs -h node01.example.com --addsubservice example_apache fs ref=web_fs
ccs -h node01.example.com --addsubservice example_apache fs name=web_fs device=/dev/sdd2 mountpoint=/var/www fstype=ext3
ccs -h node01.example.com --addsubservice service_a nfsclient[1]:nfsclient[2]:nfsclient
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
ccs -h host --rmservice servicename
ccs -h host --rmsubservice servicename subservice [service options]