Wednesday 16 September 2015

DB2 HADR - More intel. about what's goin' on

So I've previously written about HADR: -

so here's today's news from the metaphorical coal face: -

The command: -

db2pd -alldbs

gives one a HUGE amount of information about DB2 e.g.

...
Database Member 0 -- Database MONITOR -- Active -- Up 0 days 00:08:40 -- Date 2015-09-16-13.15.27.843535

Work Action Sets:
Address            ActionSetID ActionSetName                  ClassSetID  ObjectType ObjectID   
0x00007F4922917F20 2147483647  SYSDEFAULTUSERWAS              2147483647  b               3          

Work Actions:
Address            ActionSetID ActionID    ClassID     Type       ActualsOptions RefObjectID 
0x00007F4922DE9D40 2147483647  2147483647  2147483647  M               None       4           

Database Member 0 -- Database MONITOR -- Active -- Up 0 days 00:08:40 -- Date 2015-09-16-13.15.27.843574

Work Class Sets:
Address            ClassSetID  ReferenceCounter
0x00007F4922A17620 2147483647  1          

Work Classes:

Address              = 0x00007F4922D17C80 
ClassSetId           = 2147483647 
ClassId              = 2147483647 
ClassName            = SYSMANAGEDQUERIES             
Work Class Attributes: 
  Work Type          = 2                   
  Timeron Cost: 
    From Value       = 150000              
    To Value         = 0                   

Database Member 0 -- Database MONITOR -- Active -- Up 0 days 00:08:40 -- Date 2015-09-16-13.15.27.844343

...

This can be narrowed down to JUST HADR: -

db2pd -alldbs -hadr

...
Database Member 0 -- Database COGNOS -- Active -- Up 0 days 02:25:44 -- Date 2015-09-16-13.16.48.990144

                            HADR_ROLE = PRIMARY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = SYNC
                           STANDBY_ID = 1
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = db2two
                     PRIMARY_INSTANCE = db2inst1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = db2one
                     STANDBY_INSTANCE = db2inst1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 16/09/2015 10:51:06.138265 (1442397066)
          HEARTBEAT_INTERVAL(seconds) = 15
                     HEARTBEAT_MISSED = 0
                   HEARTBEAT_EXPECTED = 582
                HADR_TIMEOUT(seconds) = 60
...

or even more narrowly: -

db2pd -hadr -db monitor

Database Member 0 -- Database MONITOR -- Active -- Up 0 days 00:10:37 -- Date 2015-09-16-13.17.24.757338

                            HADR_ROLE = PRIMARY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = SYNC
                           STANDBY_ID = 1
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = db2two
                     PRIMARY_INSTANCE = db2inst1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = db2one
                     STANDBY_INSTANCE = db2inst1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 16/09/2015 13:06:49.283326 (1442405209)
          HEARTBEAT_INTERVAL(seconds) = 15
                     HEARTBEAT_MISSED = 0
                   HEARTBEAT_EXPECTED = 42
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 5
             PEER_WAIT_LIMIT(seconds) = 0
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 0.000
                  LOG_HADR_WAIT_COUNT = 0
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 19800
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 87380
            PRIMARY_LOG_FILE,PAGE,POS = S0000159.LOG, 0, 737788609
            STANDBY_LOG_FILE,PAGE,POS = S0000159.LOG, 0, 737788609
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000159.LOG, 0, 737788609
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 16/09/2015 13:02:48.000000 (1442404968)
                     STANDBY_LOG_TIME = 16/09/2015 13:02:48.000000 (1442404968)
              STANDBY_REPLAY_LOG_TIME = 16/09/2015 13:02:48.000000 (1442404968)
         STANDBY_RECV_BUF_SIZE(pages) = 4298
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 25600
                STANDBY_SPOOL_PERCENT = 0
                   STANDBY_ERROR_TIME = NULL
                 PEER_WINDOW(seconds) = 120
                      PEER_WINDOW_END = 16/09/2015 13:19:19.000000 (1442405959)
             READS_ON_STANDBY_ENABLED = N



However, we've also got this: -

db2 get snapshot for database manager

            Database Manager Snapshot

Node type                                      = Enterprise Server Edition with local and remote clients
Instance name                                  = db2inst1
Number of members in DB2 instance              = 1
Database manager status                        = Active

Product name                                   = DB2 v10.5.0.5
Service level                                  = s141128 (IP23633)

Private Sort heap allocated                    = 0
Private Sort heap high water mark              = 0
Post threshold sorts                           = Not Collected
Piped sorts requested                          = 6
Piped sorts accepted                           = 6

Start Database Manager timestamp               = 16/09/2015 10:43:14.922175
Last reset timestamp                           =
Snapshot timestamp                             = 16/09/2015 13:17:57.551177

Remote connections to db manager               = 0
Remote connections executing in db manager     = 0
Local connections                              = 0
Local connections executing in db manager      = 0
Active local databases                         = 2

High water mark for agents registered          = 14
Agents registered                              = 5
Idle agents                                    = 0

Committed private Memory (Bytes)               = 29753344

Switch list for member 0
Buffer Pool Activity Information  (BUFFERPOOL) = OFF
Lock Information                        (LOCK) = OFF
Sorting Information                     (SORT) = OFF
SQL Statement Information          (STATEMENT) = OFF
Table Activity Information             (TABLE) = OFF
Take Timestamp Information         (TIMESTAMP) = ON  16/09/2015 10:43:14.922175
Unit of Work Information                 (UOW) = OFF

Agents assigned from pool                      = 354
Agents created from empty pool                 = 33
Agents stolen from another application         = 0
High water mark for coordinating agents        = 11
Hash joins after heap threshold exceeded       = 0
OLAP functions after heap threshold exceeded   = 0

Total number of gateway connections            = 0
Current number of gateway connections          = 0
Gateway connections waiting for host reply     = 0
Gateway connections waiting for client request = 0
Gateway connection pool agents stolen          = 0

Node FCM information corresponds to            = 0
Free FCM buffers                               = 128
Total FCM buffers                              = 128
Free FCM buffers low water mark                = 128
Maximum number of FCM buffers                  = 8192
Free FCM channels                              = 128
Total FCM channels                             = 128
Free FCM channels low water mark               = 127
Maximum number of FCM channels                 = 8192


Memory usage for database manager:

  Node number                                  = 0
    Memory Pool Type                           = Other Memory
       Current size (bytes)                    = 64815104
       High water mark (bytes)                 = 66781184
       Configured size (bytes)                 = 106627072

  Node number                                  = 0
    Memory Pool Type                           = FCMBP Heap
       Current size (bytes)                    = 851968
       High water mark (bytes)                 = 851968
       Configured size (bytes)                 = 851968

  Node number                                  = 0
    Memory Pool Type                           = Database Monitor Heap
       Current size (bytes)                    = 262144
       High water mark (bytes)                 = 524288
       Configured size (bytes)                 = 393216



and, for the server that's CURRENTLY hosting both PRIMARY databases: -

...
Active utilities for database manager:

  Database name                                = MONITOR

     Node number                               = 0
     Type                                      = ROLLFORWARD RECOVERY
     ID                                        = 13
     Description                               = Database Rollforward Recovery
     Start time                                = 16/09/2015 13:05:55.638776

  Database name                                = COGNOS

     Node number                               = 0
     Type                                      = ROLLFORWARD RECOVERY
     ID                                        = 3
     Description                               = Database Rollforward Recovery
     Start time                                = 16/09/2015 10:03:37.498669

...

which is nice.

Added to this, we do have: -

db2 list applications

which shows what is connecting to what: -

Auth Id  Application    Appl.      Application Id                                                 DB       # of
         Name           Handle                                                                    Name    Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
DB2USER1 db2jcc_applica 348        192.168.33.100.40667.150916122323                              MONITOR  1    
DB2USER1 db2jcc_applica 359        192.168.33.100.40670.150916122334                              MONITOR  1    
DB2USER1 db2jcc_applica 358        192.168.33.100.40669.150916122333                              MONITOR  1    
DB2USER1 db2jcc_applica 357        192.168.33.100.40668.150916122332                              MONITOR  1    


Auth Id  Application    Appl.      Application Id                                                 DB       # of
         Name           Handle                                                                    Name    Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
DB2USER1 db2jcc_applica 381        192.168.33.100.53243.150916123702                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 374        192.168.33.100.53193.150916123559                              COGNOS   1    
DB2USER1 db2jcc_applica 380        192.168.33.100.53242.150916123701                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 373        192.168.33.100.53192.150916123558                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 379        192.168.33.100.53198.150916123606                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 372        192.168.33.100.53178.150916123553                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 378        192.168.33.100.53197.150916123603                              COGNOS   1    
DB2USER1 db2jcc_applica 384        192.168.33.100.53246.150916123706                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 377        192.168.33.100.53196.150916123602                              COGNOS   1    
DB2USER1 IBM_C10_2_1_CM 376        192.168.33.100.53195.150916123601                              COGNOS   1    

etc.

2 comments:

Unknown said...

If Db2 HADR is not using a VIP how would the F5 determine which of the HADR nodes is acting as the primary?
Thanks

Dave Hay said...

Hey Unknown ( great name, by the way )

Not sure why you think a F5 load balancer would be in the mix ? That's typically used for front-end load balancing e.g. for web sites or RESTful services / APIs.

Typically the interaction with the primary or standby is at the application/server level

As an example, WebSphere Application Server (WAS) has the Automatic Client Reroute capability, as described here

Cheers, Dave

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...