This section contains procedures to create a demo GDSv2 resource. A demo resource is used as a starting point for your own GDSv2 resource. The demo scripts are located in the GDSv2 package.
The benefit of a demo application is to quickly deploy a GDSv2 resource with minimal effort. You can then experiment with the various GDSv2 extension properties to learn about the functionality.
The application used by the demo resource of type ORCL.gds executes a background sleep for 1800 seconds. After you implement that application, you make other customizations to the ORCL.gds resource type. The application used by the demo resource of type ORCL.gds_proxy reflects the status of the Solaris Service Management Facility (SMF) system-log.
This procedure assumes you have already registered the ORCL.gds resource type. See How to Register a GDSv2 Resource Type.
# clresourcegroup create -p pathprefix=/opt/ORCLscgds/demo myrg # clresource create -g myrg -t ORCL.gds \ -p start_command="%RG_PATHPREFIX/demo_start \ -R %RS_NAME -G %RG_NAME -T %RT_NAME" -d myrs
These steps use the following optional property variables:
%RG_PATHPREFIX – Determines the path for the demo_start script.
%RS_NAME – Determines the resource name.
%RG_NAME – Determines the resource group name.
%RT_NAME – Determines the resource type name.
GDSv2 replaces the %Property_Variables with the actual resource name, resource group name, and resource type name when executing the demo_start script. These global variables can then be used by the scha_cmds(1HA) commands. For example, within the /opt/ORCLscgds/demo/demo_start script, the following is used:
/usr/cluster/bin/scha_resource_get -O extension -R ${RESOURCE} -G ${RESOURCE_GROUP} interpose_logical_hostname
# clresourcegroup online -eM myrg # clresource status myrs
=== Cluster Resources === Resource Name Node Name State Status Message ------------- --------- ----- -------------- myrs node1 Online Online - Service is online node2 Offline Offline
By default, the ORCL.gds resource type uses Oracle Solaris Cluster's PMF. If the process that is being monitored fails, PMF immediately restarts the process. In the example below, process 3006 is the process that was started by the demo_start script. This process represents the demo application, sleep 1800 &. Two PMF tags are shown below: myrg,myrs,0.mon and myrg,myrs,0.svc.
# pmfadm -1 "" STATUS myrg,myrs,0.mon pmfadm -c myrg, myrs,0.mon -n 4 -t 2 /bin/ksh -c \ '/opt/ORCLscgds/bin/gds_probe -R myrs -T ORCL.gds -G myrg' retries: 0 owner: root monitor children: all pids: 3020 STATUS myrg,myrs,0.svc pmfadm -c myrg, myrs,0.svc -a /usr/cluster/lib/sc/scds_pmf_action_script /bin/ksh -c \ '/usr/cluster/bin/hatimerun -t 299 /opt/ORCLscgds/demo/demo_start -R myrs -G myrg \ -T ORCL.gds ; echo $? > /var/cluster/run/tempubaG0f' retries: 0 owner: root monitor children: all pids: 3006
The PMF tag myrg.myrs,0.mon represents the GDSv2 monitor, and myrg,myrs,0.svcrepresents the GDSv2 application process. The PMF tag myrg,myrs,0.svc will disappear if all the application processes that are being monitored have failed. Consequently, if process 3006 dies (which it will eventually as process 3006 is sleep 1800 &), then the PMF immediately restarts the application. As a test, you can kill your equivalent process ID 3006 and reissue the clresource status myrs and pmfadm -l "" commands to see that the application was immediately restarted.
A resource of type ORCL.gds requires that you use the start_command extension property. This demo example uses additional method_command properties. You can also set these extension properties after the resource has been created. The steps below show how to set the properties during resource creation.
# clresource disable myrs # clresource delete myrs
# clresource create -g myrg -t ORCL.gds \ -p Start_command="%RG_PATHPREFIX/demo_start -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -p Stop_command="%RG_PATHPREFIX/demo_stop -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -p Probe_command="%RG_PATHPREFIX/demo_probe -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -p Validate_command="%RG_PATHPREFIX/demo_validate -R %RS_NAME -G %RG_NAME \ -T %RT_NAME" -d myrs
The demo resource of type ORCL.gds has been created.
# clresource enable myrs
This procedure assumes you have already registered the ORCL.gds_proxy resource type. See How to Register a GDSv2 Resource Type.
# clresourcegroup create -p pathprefix=/opt/ORCLscgds/demo -S mysrg
# clresource create -g mysrg -t ORCL.gds_proxy \ -p Prenet_start_command="%RG_PATHPREFIX/demo_proxy_prenet_start \ -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -p Postnet_stop_command="%RG_PATHPREFIX/demo_proxy_postnet_stop \ -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -p Validate_command="%RG_PATHPREFIX/demo_validate \ -R %RS_NAME -G %RG_NAME -T %RT_NAME" \ -d mysrs
For more information on the optional property variables used above, see How to Create a Demo Resource of Type ORCL.gds.
# clresourcegroup online -eM mysrg # clresource status mysrs === Cluster Resources === Resource Name Node Name State Status Message ------------- --------- ----- -------------- mysrs node1 Online Online - System-log is online node2 Online Online - System-log is online
The mysrs resource now reflects the state of the demo proxy application, the SMF system-log.
The Proxy_interval extension property determines how often the mysrs resource checks the status of the SMF system-log. The default is 30 seconds, and can be changed using the clresource(1CL) command.
# clresource show -p proxy_interval mysrs
=== Resources === Resource: mysrs --- Standard and extension properties --- Proxy_interval 30 Class: extension Description: Prenet_start proxy interval (seconds) Per-node: False Type: int
Within 30 seconds after you issue the svcadm disable command, the state and status on node1 should change.
# svcadm disable system-log # clresource status mysrs
=== Cluster Resources === Resource Name Node Name State Status Message ------------- --------- ----- -------------- mysrs node1 Offline Offline - System-log is offline node2 Online Online - System-log is online
After you create the demo resource of type ORCL.gds_proxy, you can make additional customizations to the resource. See Additional ORCL.gds_proxy Extension Properties.