Sample Data Service
This chapter describes a sample Sun Cluster data service, HA-DNS, for the in.named application. The in.named daemon is the Solaris implementation of the Domain Name Service (DNS). The sample data service demonstrates how to make an application highly available, using the Resource Management API.
The Resource Management API supports a shell script interface and a C program interface. The sample application in this chapter is written using the shell script interface.
The information in this chapter includes:
Overview of the Sample Data Service
The sample data service starts, stops, restarts and switches the DNS application among the nodes of the cluster in response to cluster events such as administrative action, application failure, or node failure.
Application restart is managed by the Process Monitor Facility (PMF). If application deaths exceed the failure count within the failure time window, the fault monitor fails the resource group containing the application resource over to another node.
The sample data service provides fault monitoring in the form of a PROBE method. that uses the nslookup command to ensure that the application is healthy. If the probe detects a hung DNS service, it tries to correct the situation by restarting the DNS application locally. If this does not improve the situation and the probe repeatedly detects problems with the service, then the probe attempts to fail over the service to another node in the cluster.
Specifically, the sample data service includes:
A resource type registration file that defines the static properties of the data service.
A Start callback method invoked by the RGM to start the in.named daemon when the resource group containing the HA-DNS data service is brought online.
A Stop callback method invoked by the RGM to stop the in.named daemon when the resource group containing HA-DNS goes offline.
A fault monitor to check the availability of the service by verifying that the DNS server is running. The fault monitor is implemented by a user-defined PROBE method and started and stopped by Monitor_start and Monitor_stop callback methods.
A Validate callback method invoked by the RGM to validate that the configuration directory for the service is accessible.
An Update callback method invoked by the RGM to restart the fault monitor when the system administrator changes the value of a resource property.
Defining the Resource Type Registration File
The resource type registration (RTR) file in this example defines the static configuration of the DNS resource type. Resources of this type inherit the properties defined in the RTR file.
The information in the RTR file is read by the RGM when the cluster administrator registers the HA-DNS data service.
RTR File Overview
The RTR file follows a well-defined format. Resource type properties are defined first in the file, system-defined resource properties are defined next, and extension properties are defined last. See the rt_reg(4) man page and Setting Resource and Resource Type Properties for more information.
This section describes the specific properties in the sample RTR file. It provides listings of different parts of the file. For a complete listing of the contents of the sample RTR file, see Resource Type Registration File Listing.
Resource Type Properties in the Sample RTR File
The sample RTR file begins with comments followed by resource type properties that define the HA-DNS configuration, as shown in the following listing.
# # Copyright (c) 1998-2003 by Sun Microsystems, Inc. # All rights reserved. # # Registration information for Domain Name Service (DNS) # #pragma ident "@(#)SUNW.sample 1.1 00/05/24 SMI" RESOURCE_TYPE = "sample"; VENDOR_ID = SUNW; RT_DESCRIPTION = "Domain Name Service on Sun Cluster"; RT_VERSION ="1.0"; API_VERSION = 2; FAILOVER = TRUE; RT_BASEDIR=/opt/SUNWsample/bin; PKGLIST = SUNWsample; START = dns_svc_start; STOP = dns_svc_stop; VALIDATE = dns_validate; UPDATE = dns_update; MONITOR_START = dns_monitor_start; MONITOR_STOP = dns_monitor_stop; MONITOR_CHECK = dns_monitor_check; |
Tip - You must declare the Resource_type property as the first entry in the RTR file. Otherwise, registration of the resource type will fail.
Note - The RGM treats property names as case insensitive. The convention for properties in Sun-supplied RTR files, with the exception of method names, is uppercase for the first letter of the name and lowercase for the rest of the name. Method names--as well as property attributes--contain all uppercase letters.
Some information about these properties follows.
The resource type name can be specified by the Resource_type property alone (sample) or using the Vendor_id as a prefix with a "." separating it from the resource type (SUNW.sample).
If you use Vendor_id, make it the stock symbol for the company defining the resource type. The resource type name must be unique in the cluster.
The Rt_version property identifies the version of the sample data service as specified by the vendor.
The API_version property identifies the Sun Cluster version. For example, API_version = 2, indicates that the data service runs under Sun Cluster version 3.0.
Failover = TRUE indicates that the data service cannot run in a resource group that can be online on multiple nodes at once.
RT_basedir points to /opt/SUNWsample/bin as the directory path to complete relative paths, such as callback method paths.
Start, Stop, Validate, and so on provide the paths to the respective callback method programs invoked by the RGM. These paths are relative to the directory specified by RT_basedir.
Pkglist identifies SUNWsample as the package that contains the sample data service installation.



