[Linux-ha-dev] Patch for db2 Resource agent

2010-09-16 Thread Holger Teutsch
Hi,
find attached a patch for the db2 resource agent
- holger

High: Replace call to db2_local_ps with db2nps (Thanx to Evgeny Nifontov)

db2nodes.cfg typically contains a cluster service address and db2_local_ps 
never works
in this case.
___
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de
# HG changeset patch
# User Holger Teutsch holger.teut...@web.de
# Date 1284623284 -7200
# Node ID c0630dd0be4ac8a286bda8dda1d0f618d5ef0f97
# Parent  c8d8b1126ffd66350660479f5e48670b5aeb7423
High: Replace call to db2_local_ps with db2nps (Thanx to Evgeny Nifontov)

db2nodes.cfg typically contains a cluster service address and db2_local_ps never works
in this case.

diff -r c8d8b1126ffd -r c0630dd0be4a heartbeat/db2
--- a/heartbeat/db2	Thu Sep 09 16:19:09 2010 +0200
+++ b/heartbeat/db2	Thu Sep 16 09:48:04 2010 +0200
@@ -123,7 +123,7 @@
 	db2ctrl=$db2sql/ctrl
 	db2bin=$db2sql/bin
 	db2db2=$db2bin/db2
-db2node=0 # single node instances are supported
+	db2node=0 # single node instances are supported
 
 	#	Let's make sure a few important things are there...
 	if
@@ -256,7 +256,7 @@
 #
 db2_status() {
   # We ignore the instance, the info we need is already in $vars
-  pscount=`runasdb2 $db2bin/db2_local_ps | cut -c9- |  grep ' db2[^ ]' | wc -l`
+  pscount=`runasdb2 $db2bin/db2nps $db2node | cut -c9- |  grep ' db2[^ ]' | wc -l`
   test $pscount -ge 4
 }
 
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] Patch for db2 Resource agent

2010-09-16 Thread Dejan Muhamedagic
Hi,

On Thu, Sep 16, 2010 at 03:32:43PM +0200, Holger Teutsch wrote:
 -Ursprüngliche Nachricht-
 
 On Thu, Sep 16, 2010 at 10:07:49AM +0200, Holger Teutsch wrote:
  Hi,
  find attached a patch for the db2 resource agent
  - holger
  
  High: Replace call to db2_local_ps with db2nps (Thanx to Evgeny Nifontov)
  
  db2nodes.cfg typically contains a cluster service address and
  db2_local_ps never works
  in this case.
 
 Is there any documentation or source to support this? Looking at
 the source, db2_local_ps should recover the right node number
 from db2nodes.cfg in case that file exists, then invoke db2nps
 with that node number. If it doesn't work, then it is a bug in
 db2_local_ps.
 
 Cheers,
 
 Dejan
 
 Dejan,
 the background is:
 
 db2nodes.cfg maps partition numbers to node names
 Normally this is the physical hostname.
 
 Most db2 utilities (e.g. db2start etc) map the node number to the node name.
 If node name == uname -n call locally, else invoke the
 command on the remote host via rsh or something you set via
 
 db2set DB2RSHCMD=xxx
 .
 
 On a cluster the file ~/sqllib/db2nodes.cfg is on a shared FS.
 
 If this file contains a physical hostname this will definitely be wrong after 
 a resource migration.
 
 Therefore per best practice (IBM Redbooks etc.) you put the DNS
 name of the cluster service into db2nodes.cfg.
 
 You then have to take care that the instance owner has rsh access to itself 
 via the service address.
 Else you can map  DB2RSHCMD to a script like
 
 ---
 #!/bin/sh
 #
 # Emulate inter partition call for ACC by simply do it locally
 # Install with
 #
 #   db2set DB2RSHCMD=$INSTHOME/db2_acc_rsh
 #
 # HT Dec 2007
 
 # Is called rsh like as
 # c36db.hg.fresenius.de -n -l db2c36 ARGS
 
 # remove 4 first args
 shift
 shift
 shift
 shift
 eval $@
 
 
 Other methods for working with db2nodes.cfg are
 - make links to node local files (problems with permissions)
 - edit db2nodes.cfg with the resource agent prior to an (something a IBM 
 povide lib does/tries)
 
 You see we are veterans with 100+ db2 databases. 8-) or 8-(
 
 I agree that the logic of db2_local_ps is to simple to deal with this setup.
 On the other hand I'm not confident that IBM will implement a comprehensive 
 way to detect locality for a general multi partition setup.
 This would require checking IP interfaces etc...
 
 I checked that db2nps works on DB2 8.2, 9.5 and 9.7.
 
 Any concerns let me know.

My only concern is that 0 may not be the right node number for
the local node. On failover or failback or whenever. That's why
I'd expect db2_local_ps to be the right way to go. Of course, I
do understand that things don't always work as advertised and in
particular with products such as db2 :) At any rate, if you're
sure that db2nps 0 is always going to refer to the local node,
then we can go ahead with this change.

Cheers,

Dejan

 Regards
 Holger
 ___
 Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
 Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] Patch for db2 Resource agent

2010-09-16 Thread Holger Teutsch
-Ursprüngliche Nachricht-
Von: Dejan Muhamedagic deja...@fastmail.fm
Gesendet: Sep 16, 2010 4:30:37 PM
An: High-Availability Linux Development List linux-ha-dev@lists.linux-ha.org
Betreff: Re: [Linux-ha-dev] Patch for db2 Resource agent

Hi,

On Thu, Sep 16, 2010 at 03:32:43PM +0200, Holger Teutsch wrote:
 -Ursprüngliche Nachricht-
 
 On Thu, Sep 16, 2010 at 10:07:49AM +0200, Holger Teutsch wrote:
  Hi,
  find attached a patch for the db2 resource agent
  - holger
  
  High: Replace call to db2_local_ps with db2nps (Thanx to Evgeny Nifontov)
  
  db2nodes.cfg typically contains a cluster service address and
  db2_local_ps never works
  in this case.
 
 Is there any documentation or source to support this? Looking at
 the source, db2_local_ps should recover the right node number
 from db2nodes.cfg in case that file exists, then invoke db2nps
 with that node number. If it doesn't work, then it is a bug in
 db2_local_ps.
 
 Cheers,
 
 Dejan
 
 Dejan,
 the background is:
 
 db2nodes.cfg maps partition numbers to node names
 Normally this is the physical hostname.
 
 Most db2 utilities (e.g. db2start etc) map the node number to the node 
 name.
 If node name == uname -n call locally, else invoke the
 command on the remote host via rsh or something you set via
 
 db2set DB2RSHCMD=xxx
 .
 
 On a cluster the file ~/sqllib/db2nodes.cfg is on a shared FS.
 
 If this file contains a physical hostname this will definitely be wrong 
 after a resource migration.
 
 Therefore per best practice (IBM Redbooks etc.) you put the DNS
 name of the cluster service into db2nodes.cfg.
 
 You then have to take care that the instance owner has rsh access to itself 
 via the service address.
 Else you can map  DB2RSHCMD to a script like
 
 ---
 #!/bin/sh
 #
 # Emulate inter partition call for ACC by simply do it locally
 # Install with
 #
 #   db2set DB2RSHCMD=$INSTHOME/db2_acc_rsh
 #
 # HT Dec 2007
 
 # Is called rsh like as
 # c36db.hg.fresenius.de -n -l db2c36 ARGS
 
 # remove 4 first args
 shift
 shift
 shift
 shift
 eval $@
 
 
 Other methods for working with db2nodes.cfg are
 - make links to node local files (problems with permissions)
 - edit db2nodes.cfg with the resource agent prior to an (something a IBM 
 povide lib does/tries)
 
 You see we are veterans with 100+ db2 databases. 8-) or 8-(
 
 I agree that the logic of db2_local_ps is to simple to deal with this setup.
 On the other hand I'm not confident that IBM will implement a comprehensive 
 way to detect locality for a general multi partition setup.
 This would require checking IP interfaces etc...
 
 I checked that db2nps works on DB2 8.2, 9.5 and 9.7.
 
 Any concerns let me know.

My only concern is that 0 may not be the right node number for
the local node. On failover or failback or whenever. That's why
I'd expect db2_local_ps to be the right way to go. Of course, I
do understand that things don't always work as advertised and in
particular with products such as db2 :) At any rate, if you're
sure that db2nps 0 is always going to refer to the local node,
then we can go ahead with this change.

Cheers,

Dejan


Dejan,
in a single partition database the single partition is always 0.

db2nps NN   looks on the *local* node for processes of partition NN

i.e. db2nps 0 does the required work.

So I think that's OK.

Regards
Holger
___
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/


Re: [Linux-ha-dev] Patch for db2 Resource agent

2010-09-16 Thread Dejan Muhamedagic
On Thu, Sep 16, 2010 at 05:18:10PM +0200, Holger Teutsch wrote:
 -Ursprüngliche Nachricht-
 Von: Dejan Muhamedagic deja...@fastmail.fm
 Gesendet: Sep 16, 2010 4:30:37 PM
 An: High-Availability Linux Development List linux-ha-dev@lists.linux-ha.org
 Betreff: Re: [Linux-ha-dev] Patch for db2 Resource agent
 
 Hi,
 
 On Thu, Sep 16, 2010 at 03:32:43PM +0200, Holger Teutsch wrote:
  -Ursprüngliche Nachricht-
  
  On Thu, Sep 16, 2010 at 10:07:49AM +0200, Holger Teutsch wrote:
   Hi,
   find attached a patch for the db2 resource agent
   - holger
   
   High: Replace call to db2_local_ps with db2nps (Thanx to Evgeny 
   Nifontov)
   
   db2nodes.cfg typically contains a cluster service address and
   db2_local_ps never works
   in this case.
  
  Is there any documentation or source to support this? Looking at
  the source, db2_local_ps should recover the right node number
  from db2nodes.cfg in case that file exists, then invoke db2nps
  with that node number. If it doesn't work, then it is a bug in
  db2_local_ps.
  
  Cheers,
  
  Dejan
  
  Dejan,
  the background is:
  
  db2nodes.cfg maps partition numbers to node names
  Normally this is the physical hostname.
  
  Most db2 utilities (e.g. db2start etc) map the node number to the node 
  name.
  If node name == uname -n call locally, else invoke the
  command on the remote host via rsh or something you set via
  
  db2set DB2RSHCMD=xxx
  .
  
  On a cluster the file ~/sqllib/db2nodes.cfg is on a shared FS.
  
  If this file contains a physical hostname this will definitely be wrong 
  after a resource migration.
  
  Therefore per best practice (IBM Redbooks etc.) you put the DNS
  name of the cluster service into db2nodes.cfg.
  
  You then have to take care that the instance owner has rsh access to 
  itself via the service address.
  Else you can map  DB2RSHCMD to a script like
  
  ---
  #!/bin/sh
  #
  # Emulate inter partition call for ACC by simply do it locally
  # Install with
  #
  #   db2set DB2RSHCMD=$INSTHOME/db2_acc_rsh
  #
  # HT Dec 2007
  
  # Is called rsh like as
  # c36db.hg.fresenius.de -n -l db2c36 ARGS
  
  # remove 4 first args
  shift
  shift
  shift
  shift
  eval $@
  
  
  Other methods for working with db2nodes.cfg are
  - make links to node local files (problems with permissions)
  - edit db2nodes.cfg with the resource agent prior to an (something a IBM 
  povide lib does/tries)
  
  You see we are veterans with 100+ db2 databases. 8-) or 8-(
  
  I agree that the logic of db2_local_ps is to simple to deal with this 
  setup.
  On the other hand I'm not confident that IBM will implement a 
  comprehensive way to detect locality for a general multi partition setup.
  This would require checking IP interfaces etc...
  
  I checked that db2nps works on DB2 8.2, 9.5 and 9.7.
  
  Any concerns let me know.
 
 My only concern is that 0 may not be the right node number for
 the local node. On failover or failback or whenever. That's why
 I'd expect db2_local_ps to be the right way to go. Of course, I
 do understand that things don't always work as advertised and in
 particular with products such as db2 :) At any rate, if you're
 sure that db2nps 0 is always going to refer to the local node,
 then we can go ahead with this change.
 
 Cheers,
 
 Dejan
 
 
 Dejan,
 in a single partition database the single partition is always 0.
 
 db2nps NN   looks on the *local* node for processes of partition NN
 
 i.e. db2nps 0 does the required work.
 
 So I think that's OK.

Fine. I pushed the patch. Many thanks for the contribution and
taking time to explain this.

Cheers,

Dejan

 Regards
 Holger
 ___
 GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
 Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de
 ___
 Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
 http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
 Home Page: http://linux-ha.org/
___
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/