Registering a resource type in Sun cluster 3.2

Hi,

I tried to register a resource type with name " SUNW.NServer". using following command.

" clresourcetype register SUNW.NServer

Registration file not found for "SUNW.NServer" in /usr/cluster/lib/rgm/rtreg or /opt/cluster/lib/rgm/rtreg

It looks for only resource names present in /opt/cluster/lib/rgm/rtreg directory.

If i need to regitser resource type like "SUNW.NServer" for my application. How should i do it.

Is it possible to do it. If so can i get clarification on this as soon as possible.

can anyone send me the detailed docs of installing and configuring a data service application (whch is not provided by sun cluster by default like Oracle or apache) for acheving HA in case of failover.

[752 byte] By [sudheer_rajua] at [2007-11-27 3:56:09]
# 1

Hi Sudheer,

you should read the following book:

http://docs.sun.com/app/docs/doc/819-2972

it is the data service developers guide.

But I recommend for not creating a resource type, I would strongly urge you to create a generic data service. It is ways easier than creating a new resource type.

BTW round about 50 percent of the data services on the Sun Cluster DVD are from the resource type gds

Kind regards

Detlef

deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2
Hi,I usually use just the provided gda, and implement a start, stop and probe script for the application, or depending on the application, I run it as an SMF service and monitor this SMF Service by the cluster.Fritz
Tom_Tigera at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3
Hi Tom, are you using the SMF Proxy resource, or the smf component of the HA Container agent?Kind regardsDetlef
deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4

Hi Detlef,

depends on the kind of cluster, if I have Zones, then I use the sczsmf resource of the HA Container agent, otherwise the SMF Proxy resource.

There is one important difference between the two: the sczsmf resource really monitors your application, you can provide a probe script which checks the operation of your application, while the SMF proxy resource just checks for the online Status of the SMF Service.

A nasty side effect of using Zones is that you can't grant a role in the local zone to some user to disable the monitoring of the resource from the cluster to some user, this must be done in the global zone.

Greetings

Fritz

Tom_Tigera at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 5

I know th4e SMF component and the container agent and his strngth and weeknesses quite good.

Currently the administration concept is to administer a cluster in the global zone.

If you use the smf proxy in a local zone, the root admin of this zone can use the cluster commands to disable the smf proxy, although we are discouraging to do so.

Detlef

deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 6
Hi Detlef,Thanks for the details, you have recommended for creating generic data service.Is this a different approach of acheving the HA in case of failure. Can u provide me more details on this.
sudheer_rajua at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 7
Hi Detlef,Thanks for the details, you have recommended for creating generic data service.Is this a different approach of acheving the HA in case of failure. Can u provide me more details on this.
sudheer_rajua at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 8

Hi Sundheer,

Sure,

all you need for the gds data service is a start, stop, probe and validate command.

The return code of the probe would be:

0 success

100 error

201 error wch has to trigger a failover

The stop command should stop your application reliable otherwise pmf wil send the whole process tree its stop signal. If you need parameters provide them in the commands mentioned above.

You cna either use the gds buider or just register your sripts:

1. register the type

# clrt register gds

2. clrs create -g group -

clrs create -g group \

-p Port_list=80/tcp \

-p Network_resouces_used=logica-host-rs \

-p Start_command="apps_script -p 1 -o 3 start" \

-p Stop_command="apps_script -p 1 -o 3 stop" \

-p Probe_command="apps_script -p 1 -o 3 probe" \

-p Validate_command="apps_script -p 1 -o 3 validate" \

your_name

The return code of the start script is irrelevant to determine if your resource is online. only th e probe script juges for the status.

You can add dependencies and tune the other parametes as appropriate. In the command above I just used something to demonstrate what is possible for the start command.

The whole stuff above is described verbouse and in detail in the agent developers guide. I would recommend you to read the manpage of gds

man SUNW.gds an man r_properties as an additional lecture.

Detlef

deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 9
Thanks for ur detailed explanation. So,I thing i need to have scripts for the Start,stop.,probe and validate commands for my application. I have one more query ,how many services can be registered through gds.Thanks again for sharing the information.
sudheer_rajua at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 10
The number of gds based agent has no specific limit. How many do you need?Detlef
deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 11
Hi Detlef,The scripts what u have mentioned are scripts generated automatically or should i point to scripts to start ,stop,validateand probe my application resource.Becuase in Agent builder gui i have observed saying that the scripts will be generated by it.
sudheer_rajua at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 12

Hi Sudheer,

regardeless whether you use the agent builder or just register with clrs create, you always have to give the start stop probe and validate commands your personal scripts.

If you use the agent builder it will generate a package which eases the registration, but your scripts will not be part of the package.

So just using the clrs command or the cluster manager will be sufficient, but you need to provide your scripts including parameters.

Kind regards

Detlef

deulsuna at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 13
Hi Detlef,Thanks for the details and for sharing the information.
sudheer_rajua at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 14

I have a dummy GDA Control script I used to test a GDA, and which has been used a few times as base for real control scripts.

It has one command line argument with the following values

- start-> start the service

- stop-> stop the service

- probe -> run as probe script

- daemon -> internally used to run in daemon mode

It returns the numeric value from a statusfile (or 0 if no file is found) if it is called with the argument 'probe' . tis allows you to play around with the behavior of the service.

It logs its actions in a logfile if the variable LogDir is defined. For more details see the comments in the script.

Fritz

#!/usr/bin/perl

use strict;

my $LogDir = '/var/log';

my $ControlDir = '/etc';

my $ServiceName = 'ClusterDummyService';

my $ProgName = $0;

$ProgName =~ s/.*\/([^\/]+)$/$1/;

my $KillFile = '/tmp/'.$ProgName.'.kill';

my $PidFile = '/tmp/'.$ProgName.'.pid';

my $StatusFile = "$ControlDir\/$ProgName.stat";

my ($Command) =@ARGV;

if($Command eq 'start') {

# start Application

system("$0 daemon&");

sleep(10);

logit('Daemon Started');

exit 0;

} elsif ($Command eq 'stop') {

# stop Application

system("touch $KillFile");

sleep(10);

logit('Daemon Stopped');

} elsif ($Command eq 'check') {

if ($StatusFile ne '' && -r $StatusFile) {

open STATUS,

$StatusFile;

my $stat = <STATUS>;

close STATUS;

$stat =~ s/\D*(\d*)\D*/$1/;

logit("Failed with status '$stat'") if $stat;

exit $stat;

} else {

# no tests perfomrmed, return 0

exit 0;

}

} elsif ($Command eq 'daemon') {

# run in daemon mode, remain in lopp until killfile is found

exit if (-e $PidFile);

system("echo $$ > $PidFile");

while (1) {

if (-e $KillFile) {

unlink $KillFile;

unlink $PidFile;

die ("Stopped by Kill file\n");

}

sleep 5;

}

} else {

print "invalid command '$Command'\n";

exit 0;

}

sub logit {

my ($text) = @_;

if ($LogDir ne '') {

open LOGF, ">>$LogDir\/".$ProgName.".log";

print LOGF localtime()." GDS ctl Dataservice '$ServiceName' $text\n";

close LOGF;

} else {

print localtime()." GDSctl Dataservice '$ServiceName' $text\n";

}

}

Tom_Tigera at 2007-7-12 9:00:21 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 15
Thanks Detlef and Tom for information,Can GDS can be used for application that has more than one process runningfor its startup.
sudheer_rajua at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 16

It can be used for this type of service as well. More than 50 percent of the agents on the Sun Cluster CD use GDS. If you hve additional questions, please outline the applications process stucture and I am happy to give you some advice. Please b e specific, if you have juste on process tree with multiple processes or more than one process tree in your application.

Detlef

deulsuna at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 17
Detlef,I have one process tree with 6 processes running under it for my application.I need to swithover all the processes to second node in case of failover.Also I tried to install my application on cluster file system(which is shared by both the nodes in cluster).
sudheer_rajua at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 18

Hi Sudheer,

so this is a nobrainer, just use GDS to start and monitor your application, and provide a probe command. There will be two lines of monitoring, one is your probe, which can trigger restarts and failover, and the other one is pmf (Process Monitoring Facility) which will immediately triggers a restart or failover if your process tree dies.

If you have additional questionsI am happy to answer.

Detlef

deulsuna at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 19
Detlef,I got it, and regarding the probe command, I understand that i need to set 0 -success,100-failure ,201-immediate failover in my script according to my application status. Is this right ?
sudheer_rajua at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 20

Sudheer,

Correct you got it. Just one thing to add, if your application does not answer to your probe reliable, you may consider a lower return code on connection problems. The return codes sum up to 100

In example returning 25 will accept 4 3 faulted probes in a row. The forth 25 will trigger a restart or failover.The first return of 0 restarts this counter.

Detlef

deulsuna at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 21
Thanks Detlef ,for sharing the information,
sudheer_rajua at 2007-7-21 20:58:50 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...