Operating System - HP-UX
1771254 Members
2397 Online
109004 Solutions
New Discussion юеВ

Re: Make sure that two packages cant start on the same machine

 
H Niska
Advisor

Re: Make sure that two packages cant start on the same machine


>You have a 'customer_defined_run_cmds' - >you could grep a 'ps -ef' at the beginning >to check if the other package is already >running.

Well as I wrote in the question I do it there but thats the problem

>>as it is now I do the checks in >customer_defined_run_cmds and make it fail >from there

Deepak Kr
Respected Contributor

Re: Make sure that two packages cant start on the same machine

Niska,

Its more like confusing on your part. Kindly put your question and requirement in the form of some example A B C.

This will reduce the time for your query resolution.

Can you provide the package control script's problematic section here for make it faster.

Also provide...

cmviewcl -vp package1_name
cmviewcl -vp package2_name

outputs...

"There is always some scope for improvement"
H Niska
Advisor

Re: Make sure that two packages cant start on the same machine

Ok here we go again.

I have two packages that are not allowed to run on the same machine.

Lets say we start like this

pkg1 runs on server1
pkg2 runs on server2
nothing runs on server3

server1 fails and pkg1 has server2 next in the node list and server3 last ,
so it now fails over to server2.

But I check for pkg2 in the customer_defined_run_cmds
and if it is there fail the package. BUT heres the thing I would like it to now fail over to server3
but it will not for reasons I said before.

What I would like is some way of telling the package in its configuration that it cant run pkg1 and pkg2 on the same machine, something like

DEPENDENCY_CONDITION = down

But as it is now serviceguard only supports

DEPENDENCY_CONDITION = up

function customer_defined_run_cmds
{
result=/opt/wallwrapper/checkforotherpkg.sh
if [ $result -eq 1 ]
then
false
else
/opt/wallwrapper/wallwrapper start
fi
test_return 51
}


PACKAGE STATUS STATE AUTO_RUN NODE
wallwrapper1 up running enabled osll002ps

Policy_Parameters:
POLICY_NAME CONFIGURED_VALUE
Failover configured_node
Failback manual

Script_Parameters:
ITEM STATUS MAX_RESTARTS RESTARTS NAME
Service up 0 0 Probe_wallwrapper1
Subnet up 10.72.100.0

Node_Switching_Parameters:
NODE_TYPE STATUS SWITCHING NAME
Primary up enabled osll002ps (current)
Alternate up enabled osll003ps
Alternate up enabled osll001ps


PACKAGE STATUS STATE AUTO_RUN NODE
wallwrapper2 up running enabled osll001ps

Policy_Parameters:
POLICY_NAME CONFIGURED_VALUE
Failover configured_node
Failback manual

Script_Parameters:
ITEM STATUS MAX_RESTARTS RESTARTS NAME
Service up 0 0 Probe_wallwrapper2
Subnet up 10.72.100.0

Node_Switching_Parameters:
NODE_TYPE STATUS SWITCHING NAME
Primary up enabled osll001ps (current)
Alternate up enabled osll003ps
Alternate up enabled osll002ps

Deepak Kr
Respected Contributor

Re: Make sure that two packages cant start on the same machine

Niska,

Thanks for trying to put everything in details!!

What I understand from the details is your requirement!! is following:

1. You dont want to avoid any chance of starting these two packages on same node at any point of time.

2. You want to avoid use customer_defined_cmd function to set it up!!

correct me if I am wrong!!

One thing you can do here is to change failover order of package under configured nodes in package configuration file.

Like for pkg1 you can set (node 1, node 3 and node 2)
same way for pkg2 you can set (node 2, node 3 and node 1)

provided that node is standby for running these two package in case something goes wrong with any of packages.

But this will be good when one node goes down for some reason. But if you take both nodes down for say maintenance then it will not work as per your requirement.

You can put a monitoring script here but again configured nodes will be used to failover.

Another way is to disable global switching for packages so you manually start when something goes wrong.


"There is always some scope for improvement"
H Niska
Advisor

Re: Make sure that two packages cant start on the same machine

Sorry but none of your suggestions are viable solutions, it seems the only way to go is to make the customer_defined_run_cmds part just not start the program but not fail it and then fail the package via the monitor script run by SERVICE_SCRIPT.

{
result=/opt/wallwrapper/checkforotherpkg.sh
if [ $result -eq 1 ]
then
true
else
/opt/wallwrapper/wallwrapper start
fi

test_return 51
}
Rita C Workman
Honored Contributor

Re: Make sure that two packages cant start on the same machine

Didn't read the whole thread here....

Then don't set them up to fail to the same boxes ! You have 5 boxes - give them their primary server and at least one fail over. Maybe the more essential pkg could have two failovers. That's simple enough - and that is plenty of coverage.

Face it....if your boxes are set up well - just how often do they actually failover. I have an 8 node cluster and haven't had so much as one failover in years.

For pkgs where I want pkgA to have priority over pkgB if they are on the same box, I just put this at the top of pkgA.cntl script:

/usr/sbin/cmhaltpkg -n $(/usr/bin/uname -n) pkgB

That says...stop pkgB first thing, then it will continue with the cntl script and kick off pkgA.

Just a thought,
Rta
Deepak Kr
Respected Contributor

Re: Make sure that two packages cant start on the same machine

Niska,

You better create a package monitoring script and enco-operate this check into that.

As Rita said....you need to stop another package that you dont want to run and then start the required one.

monitoring script can check the package status and take decision as per your requirement.
"There is always some scope for improvement"
H Niska
Advisor

Re: Make sure that two packages cant start on the same machine

I already implemented it as I wrote a few comments up, or atleast almost like it.

I start the program from the SERVICE_SCRIPT monitor script instead of from the customer_defined_run_cmds.