Thursday, 3 September 2015

DB2 HADR - Updating Host Names

Following my earlier posts, I've now gone to another level, cloning my DB2 HADR server ( the original standby server ) and thus creating TWO DB2 servers, one dedicated as primary and one dedicated as standby.

Of course, the delights of HADR mean that I can switch back and forth, and that's the objective - I want to have a single VM hosting WebSphere Application Server ( IBM Business Monitor ) and TWO VMs hosting DB2, so that I can properly test failover by physically turning off a VM ( shutdown -h now ).

Having made all the necessary OS and DB2 / HADR changes, the only thing that I noticed was the the DB2 catalog was out-of-date.

This is what I had: -

db2 list db directory

 System Database Directory

 Number of entries in the directory = 2

Database 1 entry:

 Database alias                       = COGNOS
 Database name                        = COGNOS
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              = IBM Cognos Content Store
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = bpm856
 Alternate server port number         = 60006

Database 2 entry:

 Database alias                       = MONITOR
 Database name                        = MONITOR
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = bpm856
 Alternate server port number         = 60006


whereas I expected the Alternate server hostname to be either db2one or db2two, depending upon at which box I looked.

How do I fix this ??

I ask Google :-)


which led me to this: -

Primary

db2 "update alternate server for database cognos using hostname db2one port 60006"
db2 "update alternate server for database monitor using hostname db2one port 60006"

Standby

db2 "update alternate server for database cognos using hostname db2two port 60006"
db2 "update alternate server for database monitor using hostname db2two port 60006"

Now the catalog looks rosy :-)

Primary

 System Database Directory

 Number of entries in the directory = 2

Database 1 entry:

 Database alias                       = COGNOS
 Database name                        = COGNOS
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              = IBM Cognos Content Store
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = db2two
 Alternate server port number         = 60006

Database 2 entry:

 Database alias                       = MONITOR
 Database name                        = MONITOR
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = db2two
 Alternate server port number         = 60006


Standby

 System Database Directory

 Number of entries in the directory = 2

Database 1 entry:

 Database alias                       = COGNOS
 Database name                        = COGNOS
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              = IBM Cognos Content Store
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = db2one
 Alternate server port number         = 60006

Database 2 entry:

 Database alias                       = MONITOR
 Database name                        = MONITOR
 Local database directory             = /home/db2inst1
 Database release level               = 10.00
 Comment                              =
 Directory entry type                 = Indirect
 Catalog database partition number    = 0
 Alternate server hostname            = db2one
 Alternate server port number         = 60006


And DB2 HADR is all clean and green.

Now to update WAS to use the correct hostnames via JDBC data sources :-)

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...