A user-defined service consists only of an application that you want to fail over using your own action scripts. For example, you could set up a highly available Internet login service. The application in a user-defined service cannot use disks. If your application is disk-based, set up a disk service or Network File System (NFS) service instead.
Before you set up a user-defined service on each member system, you must install the application that you want to fail over. You also must set up the user-defined action scripts that the TruCluster software uses to fail over the application. See Chapter 4 for more information about installing applications and creating action scripts for a service.
When you add a user-defined service, you can specify the following information:
Service name--Service names must be unique and cannot contain a slash (/).
Automatic Service Placement (ASP) policy--See Chapter 4 for information about the ASP policies.
User-defined action scripts to fail over your application--At a minimum, you must specify a start action script that includes the commands to start the application and a stop action script that includes the commands to stop the application. See Chapter 4 for more information about action scripts.
Example 7-1
shows how to add a basic user-defined service.
This example shows how to
specify pathnames for the user-defined start and stop action scripts.
In
this example, the "Adding service" menu is accessed from the
asemgr
Service Configuration menu by choosing the "Adding
a new service" item.
# asemgr
.
.
.
Adding a service Select the type of service: 1) NFS service 2) Disk service 3) User-defined service 4) DRD service 5) Tape service q) Quit without adding a service x) Exit ?) Help Enter your choice [1]: 3 You are now adding a new user-defined service to the ASE. User-Defined Service Name The name of a user-defined service must be a unique service name within the ASE. Enter the user-defined service name: start1 Modifying user-defined scripts for `start1`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: 1 Modifying the start action script for `start1`: f) Replace the start action script e) Edit the start action script g) Modify the start action script arguments [start1] t) Modify the start action script timeout [60] r) Remove the start action script x) Exit - done with changes Enter your choice [x]: f Enter the full pathname of your start action script or "default" for the default script (x to exit): /usr/sbin/start1_start Modifying the start action script for `start1`: f) Replace the action script e) Edit the start action script g) Modify the start action script arguments [start1] t) Modify the start action script timeout [60] r) Remove the start action script x) Exit - done with changes Enter your choice [x]: x Modifying user-defined scripts for `start1`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: 2 Modifying the stop action script for `start1`: f) Replace stop action script e) Edit the stop action script g) Modify the stop action script arguments [start1] t) Modify the stop action script timeout [60] r) Remove the stop action script x) Exit - done with changes Enter your choice [x]: f Enter the full pathname of your stop action script or "default" for the default script (x to exit): /usr/sbin/start1_stop Modifying the stop action script for `start1`: f) Replace the stop action script e) Edit the stop action script g) Modify the stop action script arguments [start1] t) Modify the stop action script timeout [60] r) Remove the stop action script x) Exit - done with changes Enter your choice [x]: x Modifying user-defined scripts for `start1`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: x Selecting an Automatic Service Placement (ASP) Policy Select the policy you want ASE to use when choosing a member to run this service: b) Balanced Service Distribution f) Favor Members r) Restrict to Favored Members x) Exit to service config menu ?) Help Enter your choice [n]: b Selecting an Automatic Service Placement (ASP) Policy Do you want the ASE to relocate this service to a more highly favored member if the member becomes available while the service is running (y/n/?): n Enter 'y' to add Service 'start1' (y/n): y Service successfully added...
You can set up a user-defined network or login service that uses a pseudohost name as a service name. Users can log in by using the pseudohost name and perform network operations on the host. The pseudohost name has an Internet address and resembles other hosts. The TruCluster software aliases the pseudohost name to the member system that is running the login service.
To add a user-defined login service to your ASE, you
must set up a user-defined start action script that invokes the
ifconfig alias
command and a user-defined stop action script that
invokes the
ifconfig -alias
command.
See
ifconfig(
8)
for a description of this command.
To make this easy, the TruCluster software
provides you with a script,
/var/ase/sbin/nfs_ifconfig,
that can establish and remove a host name alias.
You can invoke the
/var/ase/sbin/nfs_ifconfig
script
in your user-defined start and stop action scripts to start and stop the
login service.
To start the service, invoke the
/var/ase/sbin/nfs_ifconfig
script with the
start
argument.
To stop the
service, invoke the script with the
stop
argument.
To set up a user-defined login service, you must first add the pseudohost
name to the
/etc/hosts
file on all the member systems.
For example, to add a login service using the pseudohost name
ase10, specify a line similar to the following in the
/etc/hosts
file on all the members:
6.140.64.52 ase10.ift.tec.com ase10
Run the
asemgr
utility to add the login service,
using the pseudohost name as the service name.
Use an Automatic Service
Placement (ASP) policy that does not allow the service to relocate unless
a member system fails, because users are logged out if the login service
relocates.
Example 7-2
shows how to add a login service.
This example
shows how to edit the default user-defined start and stop action scripts
and specify the
/var/ase/sbin/nfs_ifconfig
script with
the appropriate argument.
# asemgr
.
.
.
Adding a service Select the type of service: 1) NFS service 2) Disk service 3) User-defined service 4) DRD service 5) Tape service q) Quit without adding a service x) Exit ?) Help Enter your choice [1]: 3 You are now adding a new user-defined service to the ASE. User-Defined Service Name The name of a user-defined service must be a unique service name within the ASE environment. Enter the user-defined service name:ase10 Modifying user-defined scripts for `ase10`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: 1 Modifying the start action script for `ase10`: f) Replace the start action script e) Edit the start action script g) Modify the start action script arguments [ase10] t) Modify the start action script timeout [20] r) Remove the start action script x) Exit - done with changes Enter your choice [x]: f Enter the full pathname of your start action script or "default" for the default script (x to exit): default Modifying the start action script for `ase10`: f) Replace the start action script e) Edit the start action script g) Modify the start action script arguments [ase10] t) Modify the start action script timeout [60] r) Remove the start action script x) Exit - done with changes Enter your choice [x]: e #!/bin/sh # # PATH=/sbin:/usr/sbin:/usr/bin export PATH ASETMPDIR=/var/ase/tmp if [ $# -gt 0 ]; then svcName=$1 else svcName= fi # # the nfs_ifconfig script will send any # stdout/stderr to the following log file: # LOGGER=/var/ase/tmp/childLog.$$ rm -f ${LOGGER} # # Run the ase ifconfig script to start the alias. # This will do an # ifconfig <interface_id> alias ${svcName} to # to get the login service going # /var/ase/sbin/nfs_ifconfig $$ start ${svcName} returnValue=$? # # If anything in the logger cat it to stdout which will then be # sent to the syslog daemon.log # if [ -f ${LOGGER} ]; then cat ${LOGGER} fi rm -f ${LOGGER} # # exit with the return value of the nfs_ifconfig command. # exit ${returnValue} :wq Modifying the start action script for `ase10`: f) Replace the start action script e) Edit the start action script g) Modify the start action script arguments [ase10] t) Modify the start action script timeout [60] r) Remove the start action script x) Exit - done with changes Enter your choice [x]: [Return] Modifying user-defined scripts for `ase10`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: 2 Modifying the stop action script for `ase10`: f) Replace the stop action script e) Edit the stop action script g) Modify the stop action script arguments [ase10] t) Modify the stop action script timeout [60] r) Remove the stop action script x) Exit - done with changes Enter your choice [x]: f Enter the full pathname of your stop action script or "default" for the default script (x to exit): default Modifying the stop action script for `ase10`: f) Replace the stop action script e) Edit the stop action script g) Modify the stop action script arguments [ase10] t) Modify the stop action script timeout [60] r) Remove the stop action script x) Exit - done with changes Enter your choice [x]: e #!/bin/sh # # PATH=/sbin:/usr/sbin:/usr/bin export PATH ASETMPDIR=/var/ase/tmp if [ $# -gt 0 ]; then svcName=$1 else svcName= fi # # the nfs_ifconfig script will send any # stdout/stderr to the following log file. # LOGGER=/var/ase/tmp/childLog.$$ rm -f ${LOGGER} # # Run the ase ifconfig script to stop the alias. # This will do an # ifconfig <interface_id> -alias ${svcName} to # get the login service stopped # /var/ase/sbin/nfs_ifconfig $$ stop ${svcName} returnValue=$? # # If anything in the logger cat it to stdout which will then be # sent to the syslog daemon.log # if [ -f ${LOGGER} ]; then cat ${LOGGER} fi rm -f ${LOGGER} # # exit with the return value of the nfs_ifconfig command. # exit ${returnValue} :wq Modifying the stop action script for `ase10`: f) Replace stop action script e) Edit the stop action script g) Modify the stop action script arguments [ase10] t) Modify the stop action script timeout [60] r) Remove the stop action script x) Exit - done with changes Enter your choice [x]: x Modifying user-defined scripts for `ase10`: 1) Start action 2) Stop action 3) Add action 4) Delete action 5) Check action x) Exit - done with changes Enter your choice [x]: x Selecting an Automatic Service Placement (ASP) Policy Select the policy you want ASE to use when choosing a member to run this service: b) Balanced Service Distribution f) Favor Members r) Restrict to Favored Members x) Exit to service config menu ?) Help Enter your choice [b]: [Return] Selecting an Automatic Service Placement (ASP) Policy Do you want ASE to relocate this service to a more highly favored member if one becomes available while the service is running (y/n/?):n Enter 'y' to add Service 'ase10' (y/n): y Adding service... Starting service... Saving the updated database... Service successfully added...