Operating System - HP-UX
1848054 Members
6858 Online
104022 Solutions
New Discussion

dependencies between packages with ServiceGuard

 
David Macchion
Occasional Contributor

dependencies between packages with ServiceGuard

Hey,

I have an oracle pkg running on box A and another pkg running on box A that requires oracle be up.

I start up the cluster manually. So I manually cope with the dependency.

But I don't control the order in which pkgs are restarted in case of fail over on box B.

Is there any way to ?
Should I use a resource to synchronize the two packages ?

Thanks,

David
8 REPLIES 8
Bharat Katkar
Honored Contributor

Re: dependencies between packages with ServiceGuard

One way i would suggest is to check for status of required package status in user defined commands segment of control script.
You put a shell script that check for the Online status of pkg1 and in case it is done then proceed with the startup of pkg2.

It would be helpful if you closely monitor the startup time of other package and accordingly frame your script with sleep statement.



You need to know a lot to actually know how little you know
G. Vrijhoeven
Honored Contributor

Re: dependencies between packages with ServiceGuard

Hi David,

I am not sure of the start order.
What you can do create a script that does a check of the package it depends on in runnin, if not start the package and continue, if so continue right away. And add that script in the custome_defined_run_cmds section of the package. This way you are sure package 1 is started first.
You can also add a check in node name.

something file this

NODE=`hostname`
cmviewcl -p | grep -q running
if [ $? -ne 0]
then
cmrunpkg -n $NODE
fi

HTH,

Gideon
RAC_1
Honored Contributor

Re: dependencies between packages with ServiceGuard

I am sure, you can control the order in which packages will start. It is some there in cmclconfig.

If I understand your question correctly, the concern is if any of these crash, needs to be switched to another node.

In that case, you can put some code in control script of noth packages in such a way that if anyone of them crashes, it checks if other is running and shuts it down and brings both packages up on another node in the order you want.

The trick here is that code which will go in each packages control scripts.

Anil
There is no substitute to HARDWORK
David Macchion
Occasional Contributor

Re: dependencies between packages with ServiceGuard

Thanks guys,

If I wait for oracle to come up in my customer_defined_run_cmds, it means I have to increase the RUN_SCRIPT_TIMEOUT by the time oracle needs to come up.

Typically, oracle may need 120 seconds while the pkg it depends on (let's call it PKG_D) may need only 10.

So I'm not reactive anymore to detecting quickly failures on PKG_D when I start up the cluster manually.

But I guess I'll be forced to that trade-off!
Ashwani Kashyap
Honored Contributor

Re: dependencies between packages with ServiceGuard

Its true that when the cluster starts automatically or when there is a failover , its impossible to control the order of packages startup .

when I have package dependencies what I do is during the DB package startup , I explicity define in customer defined section , to halt the application package irrespective of whether its up or not . when the DB package is up it starts up the dependent package.
Carsten Krege
Honored Contributor

Re: dependencies between packages with ServiceGuard

As a sidenote I want to add that it is planned for the future Serviceguard version A.11.17 (sometime in 2005) to add real package dependencies. This means that it will be possible to define which packages have to run on the same or on different cluster nodes and in which order they have to be started or stopped.

Carsten
-------------------------------------------------------------------------------------------------
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
IT Response
Esteemed Contributor

Re: dependencies between packages with ServiceGuard

Kent Ostby
Honored Contributor

Re: dependencies between packages with ServiceGuard

David --

It seems as though you could also do this by nesting scripts.

Lets call them Package A (oracle) and Package B (dependent package).

Have Package B start up a script that calls the "real startup script" and then loops.

If it dies then SG will restart it so you will have to have logic in that script to check to see if both oracle and the real process are already up.

So if you are starting up "myapplication" in Package B then the logic would look like this:

Service Guard Script logic:
Start application script

Application_script logic:

If myapplication is not running
LOOP: if oracle is running
start my application
else
sleep and then do LOOP again
else (application is running)
sleep forever

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"