Article Figure 1 Figure 2 Listing 1 Listing 2
Listing 3 Listing 4 Listing 5 Listing 6 Sidebar 1
Sidebar 2 Table 1 Table 2 Table 3 may2006.tar

Listing 6 Build resource example

#!/usr/bin/sh
#####
# This build the basic resources for Sun Cluster 3.1u1
# Configuration Section
#

SERVICE_NAME=`echo $1 | tr -s '[a-z]' '[A-Z]'`
NODE1=$2
NODE2=$3
FSPATH=$4

PATH=/usr/cluster/bin:/usr/bin

if [ ! ${SERVICE_NAME} ]
then
    echo "NO APP DEFINED"
    exit
fi

if [ ! ${NODE1} ]
then
    echo "NO Cluster Node 1 DEFINED"
    exit
fi

if [ ! ${NODE2} ]
then
    echo "NO Cluster Node 2 DEFINED"
    exit
fi

if [ ! ${FSPATH} ]
then
    echo "NO FS PATH DEFINED"
    exit
fi


#### End configuration Section
AGENT_PATH=/opt/Cluster_Agents/${SERVICE_NAME}

IPMP_GROUP_NAME="${SERVICE_NAME}"
LOGICAL_HOSTNAME="`hostname`-${SERVICE_NAME}"
SERVICE_DEPEND="${SERVICE_NAME}-network,${SERVICE_NAME}-disk"
PORT_LIST="5555/tcp,5556/tcp"

#########
# Register resource types
#scrgadm -a -t SUNW.LogicalHostname
#scrgadm -a -t SUNW.SharedAddress
#scrgadm -a -t SUNW.HAStoragePlus
#scrgadm -a -t SUNW.gds:3.1
#
#Configure resourcegroup application-rg
#

# Create the resource group, which the following resources will be assigned

scrgadm -a -g ${SERVICE_NAME}-rg \
-y Nodelist="${NODE1},${NODE2}" \
-y Maximum_primaries=1 \
-y Desired_primaries=1 \
-y Failback=FALSE \
-y RG_mode=FAILOVER \
-y Implicit_network_dependencies=TRUE \
-y Pingpong_interval=3600 \
-y Auto_start_on_new_cluster=TRUE \
-y RG_project_name="default"

#Configure resource application-disk Mount point must be resolvable in 
#/etc/vfstab

scrgadm -a -j ${SERVICE_NAME}-disk -g ${SERVICE_NAME}-rg -t SUNW.HAStoragePlus \
-y START_TIMEOUT=90 \
-y STOP_TIMEOUT=1800 \
-y VALIDATE_TIMEOUT=1800 \
-y UPDATE_TIMEOUT=90 \
-y MONITOR_START_TIMEOUT=90 \
-y MONITOR_STOP_TIMEOUT=90 \
-y MONITOR_CHECK_TIMEOUT=90 \
-y PRENET_START_TIMEOUT=1800 \
-y POSTNET_STOP_TIMEOUT=1800 \
-y Failover_mode=NONE \
-y Retry_count=2 \
-y Retry_interval=300 \
-x FilesystemMountPoints="${FSPATH}" \
-x AffinityOn=TRUE \
-y Resource_project_name="default"

#Configure resource application-network hostname must be resolveable in 
#/etc/hosts
#Ensure that DNS A and PTR records exist and resolve correctly 

scrgadm -a -j ${SERVICE_NAME}-network -g ${SERVICE_NAME}-rg -t SUNW.LogicalHostname \
-y START_TIMEOUT=500 \
-y STOP_TIMEOUT=300 \
-y VALIDATE_TIMEOUT=300 \
-y UPDATE_TIMEOUT=300 \
-y MONITOR_START_TIMEOUT=300 \
-y MONITOR_STOP_TIMEOUT=300 \
-y MONITOR_CHECK_TIMEOUT=300 \
-y PRENET_START_TIMEOUT=300 \
-y Failover_mode=NONE \
-y Cheap_probe_interval=60 \
-y Thorough_probe_interval=60 \
-y Retry_count=2 \
-y Retry_interval=60 \
-x NetIfList="${IPMP_GROUP_NAME}@1,${IPMP_GROUP_NAME}@2" \
-x HostnameList="${LOGICAL_HOSTNAME}" \
-y Resource_project_name="default"

#Online the service resource group
scswitch -o -g ${SERVICE_NAME}-rg

#Enable the network resource
scswitch -e -j ${SERVICE_NAME}-network

#Enable the disk resource
scswitch -e -j ${SERVICE_NAME}-disk

#Online the resource group with network and disk resources
scswitch -Z -g ${SERVICE_NAME}-rg 

#Configure the geneic resource to manage (start/stop/monitor) application 
#service

scrgadm -a -j ${SERVICE_NAME}-application -g ${SERVICE_NAME}-rg -t SUNW.gds:3.1 \
-y Scalable=FALSE \
-y START_TIMEOUT=200 \
-y STOP_TIMEOUT=60 \
-y VALIDATE_TIMEOUT=300 \
-y UPDATE_TIMEOUT=300 \
-y MONITOR_START_TIMEOUT=300 \
-y MONITOR_STOP_TIMEOUT=300 \
-y MONITOR_CHECK_TIMEOUT=300 \
-y Failover_mode=NONE \
-y Network_resources_used="${LOGICAL_HOSTNAME}" \
-y Port_list="${PORT_LIST}" \
-y Thorough_probe_interval=60 \
-y Retry_count=2 \
-y Retry_interval=300 \
-x Monitor_retry_count=4 \
-x Monitor_retry_interval=5 \
-x Probe_timeout=130 \
-x Child_mon_level=-1 \
-x Start_command="${AGENT_PATH}/start" \
-x Stop_command="${AGENT_PATH}/stop" \
-x Probe_command="${AGENT_PATH}/monitor" \
-x Network_aware=TRUE \
-x Stop_signal=9 \
-x Failover_enabled=TRUE \
-y Resource_dependencies="${SERVICE_DEPEND}" \
-y Resource_project_name="default"