This section describes how to manage applications in the the following scenarios:
Scenario 1: Simple application on a single cluster - This application runs only on a single cluster. The application can be modeled as a single cluster resource, which can then added to a single resource group. NEPs would then be able to manage their application by changing the state of a resource group to online or offline. The command to bring the resource group to online state is clresourcegroup online and to bring the resource group to offline state is clresourcegroup online.
The other management states operations are
manage: Resource groups are in an unmanaged state when they are created. Use the manage subcommand to bring the resource group to a managed state. If you use this subcommand in a non-global zone, it successfully operates only on resource groups whose node list contains that zone. If you use this subcommand in the global zone, it can operate on any resource group. See example:
/usr/cluster/bin/clresourcegroup manage {+| resourcegroup?}
quiesce: This command stops a resource group from continuously switching from one node or zone to another node. If you use this subcommand in a non-global zone, it operates only on resource groups whose node list contains that zone. If you use this subcommand in the global zone, it can operate on any resource group. Use the -k option to kill methods that are running on behalf of resources in the affected resource groups. If you do not specify the -k option, methods are allowed to continue running until they exit or exceed their configured timeout. See example:
/usr/cluster/bin/clresourcegroup quiesce [*-k*] {+| resourcegroup?}
For more information on changing the state of a resource group, see clrg(1CL).
Scenario 2: Application using multiple components deployed on a single cluster - This application can be managed by using multiple resource group. These resource groups can be managed using the provisioning service. However, the dependency issues between the resource groups should be considered. The state of resource group may have to be changed to online or offline in a sequential order. The administration provisioning service can be used to manage the resource groups lifecycle.
Scenario 3: Application using multiple components deployed on multiple clusters - This application is a multi-tier application. Within a cluster, NEPs could assign the application or each application component to a resource group, as described in scenarios 1 and 2. These resource groups can be managed using the provisioning service. However, the dependency issues between resource groups and within each resource group should be considered.
Consider an example of a 3 tier application where a simple start plan sequentially calls the start procedure for the components representing the 3 tiers of a sample application. Tier 1 is the access logic tier, tier 2 is the business logic tier, and tier 3 is the data tier. The sequence of the start order is 3, 2, and 1 and the stop order is 1, 2, and 3. Sample code of a composite plan for starting and stopping a 3 tier application is as follows. In this sample, DbComponent, AsComponent, and WsComponent representing tier 3, 2 and 1 respectively are installed and our example plans are run on three hosts, that is, one host per each tier.
Sample code for starting a 3 tier application
<?xml version="1.0" encoding="UTF-8"?> <!-- generated by N1 SPS --> <executionPlan xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' name='startThreeTierApp' version='5.2.4' xsi:schemaLocation='http://www.sun.com/schema/SPS plan.xsd' xmlns='http://www.sun.com/schema/SPS'> <compositeSteps> <inlineSubplan planName='startTierThree'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Start tier 3 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierThreeHost]" value2=":[hName]"/></condition> <then> <call blockName='startDbComponent'> <installedComponent name='dbComponent' path='/some/path/db'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> <inlineSubplan planName='startTierTwo'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Start tier 2 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierTwoHost]" value2=":[hName]"/></condition> <then> <call blockName='startAsComponent'> <installedComponent name='dbComponent' path='/some/path/as'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> <inlineSubplan planName='startTierOne'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Start tier 1 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierOneHost]" value2=":[hName]"/></condition> <then> <call blockName='startWsComponent'> <installedComponent name='dbComponent' path='/some/path/ws'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> </compositeSteps> </executionPlan>
Sample code for stopping a 3 tier application
<?xml version="1.0" encoding="UTF-8"?> <!-- generated by N1 SPS --> <executionPlan xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' name='stopThreeTierApp' version='5.2.4' xsi:schemaLocation='http://www.sun.com/schema/SPS plan.xsd' xmlns='http://www.sun.com/schema/SPS'> <compositeSteps> <inlineSubplan planName='stopTierOne'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Stop tier 1 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierOneHost]" value2=":[hName]"/></condition> <then> <call blockName='stopWsComponent'> <installedComponent name='dbComponent' path='/some/path/ws'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> <inlineSubplan planName='stopTierTwo'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Stop tier 2 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierTwoHost]" value2=":[hName]"/></condition> <then> <call blockName='stopAsComponent'> <installedComponent name='dbComponent' path='/some/path/as'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> <inlineSubplan planName='stopTierThree'> <varList> <var name="hName" default=":[target(/):sys.hostName]"/> </varList> <simpleSteps implicitLocking='true'> <!-- plan runs on three hosts (one host for each tier). Stop tier 3 if and only if this machine is hosting it.--> <if> <condition><equals value1=":[tierThreeHost]" value2=":[hName]"/></condition> <then> <call blockName='stopDbComponent'> <installedComponent name='dbComponent' path='/some/path/db'></installedComponent> </call> </then> </if> </simpleSteps> </inlineSubplan> </compositeSteps> </executionPlan>