1835242 Members
1970 Online
110078 Solutions
New Discussion

Failover scripts

 
SOLVED
Go to solution
Mike Barron_3
Advisor

Failover scripts

Heres the situation:

I have a 2 node cluster

Prod node: I have 2 db instances on individual packages, snfuprd and snfcprd.
Each of these packages have a dbstart script in the "customer run defined commands"

Test Node: I have 4 db instances set up the same way.

What I want to:
When one of my prod packages fails over to the test server I want to shut down one of the test packages on the test server....

Any one have any examples of scripts that do this? Any help would be appreciated...

I hope this makes sense.
3 REPLIES 3
George A Bodnar
Trusted Contributor
Solution

Re: Failover scripts

If test and production are both different packages then you can use RESOURCE Dependencies within service guard to accomplish this.

I think you could use these to create a dependency that says only run if the prod package != test server.

I don't have an exact example of this, but have used resource dependencies in the package ascii file to tie packages together (i.e. application package starts after database packages, etc.)

Hope that helps.
Rich Wright
Trusted Contributor

Re: Failover scripts

Herer is an example from .cntl file.
-------------------
function customer_defined_run_cmds
{
# ADD customer defined run commands.

# This will execute any PRE_STARTUP commands that need to execute before
# bringing up this package. The most likely contents of this script
# will be to execute a series of shutdown commands for the databases
# on the failover node.

if [ -x $PRE_STARTUP ];then
$PRE_STARTUP
fi
----------------------
The script defined as $PRE_STARTUP is different on each node depending on what needs to be shut down prior to starting the package.
Jeff Schussele
Honored Contributor

Re: Failover scripts

Hi Mike,

George & Rich have pretty much set you on the correct track.
What I want to point out is that in your scenario you'll have to wait until the pre-startup scripts complete successfully before the adopted pkg will start.
So bear in mind that you'll have to calculate the DB shutdown & startup time as well as detection in the failover times as a whole.
And note the deliberate use of the word successfully in that statement, if pkg_to_stop doesn't, then pkg_to_start won't as well. Your monitor scripts are just as critical. If you don't failover a DB that doesn't respond to normal client traffic but does respond to simple monitors, than you have no failover.


My $0.02
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!