Oracle Solaris Cluster Generic Data Service (GDS) Guide

Exit Print View

Updated: July 2014, E48652-01
 
 

Creating a GDSv2 Resource

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.


Note -  The purpose of using demo applications is to showcase the behavior of the GDSv2 resource type. As such, these demo applications are just simple commands that are already installed and configured on Oracle Solaris 11.

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.

How to Create a Demo Resource of Type ORCL.gds

This procedure assumes you have already registered the ORCL.gds resource type. See How to Register a GDSv2 Resource Type.

  1. On one cluster node, assume the root role.
  2. Create a failover resource group and a demo resource of type ORCL.gds.

    Note -  A resource of type ORCL.gds requires that the Start_command extension property is used. All other extension properties are optional.
    # 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
  3. Bring the resource online.
    # 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
  4. Verify that the Oracle Solaris Cluster PMF is running and display the PMF tag information for the myrs resource.

    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.

  5. Set additional method_command extension properties.

    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.

    1. Disable and delete the resource.
      # clresource disable myrs
      # clresource delete myrs
    2. Create the resource.
      # 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.

  6. Enable the resource.
    # clresource enable myrs

How to Create a Demo Resource of Type ORCL.gds_proxy

This procedure assumes you have already registered the ORCL.gds_proxy resource type. See How to Register a GDSv2 Resource Type.

  1. On one cluster node, assume the root role.
  2. Create a scalable resource group and a demo resource of type ORCL.gds_proxy.
    # 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.

  3. Bring the resource online.
    # 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.


    Note -  A resource of type ORCL.gds_proxy requires that the demo_proxy_prenet_start extension property is used. All other extension properties are optional.
  4. Display the proxy interval for the mysrs resource.

    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
  5. Disable the SMF system-log service on one node and verify that the mysrs resource reflects the new state of the system-log.

    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.