孔再华
作者孔再华2018-07-03 10:12
数据库运维工程师, 中国民生银行

实战DB2 purescale集群HADR环境联机升级修订包(上)

字数 61021阅读 1246评论 0赞 6

从DB2 V10.5开始,DB2 pureScale集群支持HADR容灾解决方案和联机安装修订包。本文主要通过实际环境操作,介绍如何在DB2 pureScale集群HADR环境滚动联机升级补丁包:升级前所需要做的准备工作,升级步骤,升级检查等。


Db2 pureScale集群HADR特性介绍

Db2 pureScale功能为数据库提供了本地高可用的集群架构。在本地高可用的基础上,Db2的HADR功能能够满足企业远程灾备的需要。从Db2 V10.5开始,HADR功能与pureScale功能开始结合在一起,共同为数据库提供了本地高可用加远程灾备的解决方案。

在pureScale架构里面,多个成员共同为一个数据库服务。每个成员都会记载各自的日志。所以在Db2 pureScale集群架构里面,Db2生成了多个日志流。基于这种多日志流,Db2 HADR功能会去合并日志流,然后重放,从而达到同步的功能。

Db2 pureScale集群HADR容灾架构

在Db2 pureScale集群HADR容灾架构的体系中,主备站点都是Db2 pureScale集群。对于所有在主集群的成员产生的日志流,备集群会在其中一个成员节点上接受所有的日志流,合并并重放,从而达到同步的目的。
图1. Db2 pureScale HADR架构
v4oas58l559d

v4oas58l559d

Db2 pureScale集群HADR功能也能很好的应用pureScale集群的高可用特性。如果主集群的成员出现故障,其他成员节点可以帮助传输日志到备集群,因为存储是共享的,所以所有日志流都是集群内部节点都可见的。如果是备集群的HADR回放节点出现故障,其他健康的成员节点也可以自动接管回放的工作。总之一切都是为了高可用,零宕机。

Db2 pureScale集群环境联机修订包升级特性介绍

Db2 pureScale集群最大的特点之一就是本地高可用性。无论是意外宕机还是计划的停机维护,pureScale集群都能够通过滚动维护的方式,完成维护工作的同时,保证数据库提供服务不中断。但是对于升级数据库修订包这样的工作,因为是对集群本身进行维护,就需要停止整个集群。如果数据库对服务可用性要求特别高,缺少升级的时间窗口,那么修订包的升级就会成为企业很大的难题。

Db2 pureScale集群环境联机修订包升级

从Db2 V10.5开始,pureScale集群管理引入了新的功能:联机升级修订包。首先需要了解的是Db2为了做到这一点,在Db2 发行版里面引入了体系结构级别和代码级别这两个概念。联机修订包的升级就是关于这两个级别的升级。

在 Db2 pureScale 实例中,所有成员和 CF 都在同一体系结构级别运行,该级别称为当前有效体系结构级别 (CEAL)。此外,所有成员和 CF 都在同一代码级别运行,该级别称为当前有效代码级别 (CEAL)。Db2 pureScale实例的升级,就是升级和关注体系结构级别,代码级别,当前有效体系结构级别和当前有效代码级别。只有落实了当前有效体系结构级别和当前有效代码级别已经升级到了预期级别,修订包的升级才算最终成功。

检查实例各项级别

使用db2pd工具可以查看当前实例的各项级别。如下面的清单所示:
清单 1. 检查Db2 pureScale实例修订包级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:06:00 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:51:54 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/21:12:06:01 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/26:12:06:44

在这个案例里面,当前Db2 pureScale实例是一个2+2的结构。两个member和两个CF的级别信息都同时反映了出来。在这个输出里面,体系结构级别(Architecture Level),代码级别(Code Level),当前有效体系结构级别(CEAL)和当前有效代码级别(CECL)都是“V:10 R:5 M:0 F:0 I:0”,也就是10.5.0.0,是GA版本。

Db2 pureScale集群HADR环境联机修订包升级

Db2 pureScale集群HADR环境相对要更复杂一些。因为牵扯到同步的问题,新的修订包会兼容老的修订包产生的日志,但是反之则不一定。所以在HADR环境,用户需要在先完成HADR备站点的升级,再完成HADR主站点的升级。

实战升级环境描述

本次案例将介绍如何在Db2 pureScale集群HADR环境,联机升级修订包。本次实战环境是一套配置了HADR远程灾备的pureScale集群环境。有A B两个主备站点。每个站点都是一套2+2的pureScale集群。 A站点主机分别是siteam1,siteam2,siteaf1和siteaf2。其中siteam1和siteam2是成员节点M0和M1,siteaf1和siteaf2是CF节点。与此对应的,B站点主机分别是sitebm1,sitebm2,sitebf1和sitebf2。其中sitebm1和sitebm2是成员节点M0和M1,siteaf1和siteaf2是CF节点。在实战过程中,A站点是主站点,应用一直在跑。B站点是备站点,一种通过HADR功能接受和回放日志,保持同步状态。这套环境原先安装的是Db2 V10.5的GA版本,将会被升级到Db2 V10.5的FP1,也就是修订包1.

实战过程中将验证升级的步骤,验证每一步的集群状态,HADR功能所受的影响,应用所受的影响等。

升级补丁包前的准备工作

在升级补丁包之前,需要确认系统是否满足修订包的升级。Db2在安装包里面提供了db2prereqcheck工具,可以用来检查当前系统是否满足安装要求。
清单 2. 检查是否满足安装需求

# ./db2prereqcheck -i -p

其中选项-i是检查最新的版本的要求,-p是检查使用到pureScale集群所需要的需求。如果检查结果中没有报错,则说明当前系统满足安装需求。如果有错误信息,一定要先解决的这些问题之后,才可以继续安装。

系统需求确认完毕后,还需要考虑一下磁盘空间问题。因为Db2 pureScale环境安装修订包并不是覆盖安装,而是需要先安装到一个单独的位置,升级完成后才可以删除以前的修订包。而安装的修订包的大小需要超过3个多G。所以安装目录一定要保证空余4G以上。

最后检查当前集群状态,准备升级方案。

升级Db2 pureScale集群HADR环境

升级Db2 pureScale集群HADR环境的步骤可以初略分为四步: 滚动升级备集群节点, 滚动升级主集群节点, 备集群升级提交和主集群升级提交.

滚动升级备集群

备集群的滚动升级是指在尽量减少对HADR正常同步功能的影响的情况下,将备集群的所有节点的体系结构级别(Architecture Level),代码级别(Code Level)更新到目标版本。

升级之前,首先查看实例状态和HADR的状态是否正常。
清单 3. 查看实例状态

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               PRIMARY                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               CATCHUP                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

清单 4. 查看HADR状态

$ db2pd -d TESTDB -hadr

Database Member 0 -- Database TESTDB -- Standby -- Up 0 days 00:00:30 -- Date 2013-08-29-10.36.59.473564

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam1
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.778012 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 13
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 4.856
                  LOG_HADR_WAIT_COUNT = 1722358
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000016.LOG, 10522, 1709975737
            STANDBY_LOG_FILE,PAGE,POS = S0000016.LOG, 10522, 1709975737
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000016.LOG, 10522, 1709975737
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/29/2013 10:25:30.000000 (1377743130)
                     STANDBY_LOG_TIME = 08/29/2013 10:25:30.000000 (1377743130)
              STANDBY_REPLAY_LOG_TIME = 08/29/2013 10:25:30.000000 (1377743130)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 1
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam2
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 1
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.765026 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 0
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000010
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 8.904
                  LOG_HADR_WAIT_COUNT = 783810
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
            STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
                     STANDBY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
              STANDBY_REPLAY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

检查结果中,HADR状态正常,处于PEER状态。其中主集群有两个member节点,分别是siteam1和siteam2,备集群的sitebm1节点是重放节点,负责接收主集群两个节点的日志流,合并并在当前节点重放。备集群的sitebm2处于空闲状态。

清单 5. 查看实例级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:06:00 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:51:54 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/21:12:06:01 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/26:12:06:44

备集群四个节点的所有级别都是10.5.0.0版本。本次实战的目标是升级到10.5.0.1版本。首先开始升级备集群的Secondary CF节点。

清单 6. 更新secondary cf节点

# ./installFixPack -p /opt/IBM/db2/V10.5FP1 -I db2sdin1 -online -l /tmp/installFixPack.log
Db2 installation is being initialized.


Db2 pureScale online update evaluation:
=======================================
Hostname:sitebf2 
Instance name:db2sdin1 
Target Installation path:/opt/IBM/db2/V10.5FP1 
Target Code level         =  Version:10 Release:5 Modification:0 Fixpack:1
Target Architecture level =  Version:10 Release:5 Modification:0 Fixpack:1

TSA version installed on this host : 3.2.2.5 
TSA version present on the media : 3.2.2.5
TSA version after update : 3.2.2.5 

GPFS version installed on the host: 3.5.0.7 
GPFS version present on the media : 3.5.0.7
GPFS version after update : 3.5.0.7 

Total number of tasks to be performed: 6 
Total estimated time for all tasks to be performed: 1954 second(s) 

Task #1 start
Description: Installing Db2 database product binaries  
Estimated time 1485 second(s) 
Task #1 end 

Task #2 start
Description: Stopping the cluster caching facility (CF) on the local host 
Estimated time 10 second(s) 
Task #2 end 

Task #3 start
Description: Stopping the instance on the local host 
Estimated time 10 second(s) 
Task #3 end 

Task #4 start
Description: Updating the Db2 database manager instance configuration 
Estimated time 429 second(s) 
Task #4 end 

Task #5 start
Description: Starting the instance on the local host 
Estimated time 10 second(s) 
Task #5 end 

Task #6 start
Description: Starting the cluster caching facility on the local host 
Estimated time 10 second(s) 
Task #6 end 

The execution completed successfully.

For more information see the Db2 installation log at 
"/tmp/installFixPack.log".

在上面这个案例里面,升级的是db2sdin1实例,原先的Db2介质安装路径是/opt/IBM/db2/V10.5, 那么升级的时候需要选择一个不同的路径。这里选择的新安装路径是/opt/IBM/db2/V10.5FP1。安装工具检测到目标修订包的体系结构级别(Architecture Level),代码级别(Code Level)都是10.5.0.1。

修订包安装的过程中还检测了TSA和GPFS的当前版本和目标版本。其中TSA的当前版本和目标版本都是3.2.2.5。GPFS的当前版本和目标版本都是3.5.0.7。所以都不需要升级。

在升级节点的过程中,这个节点的实例将会被重启并修改配置。这是非常重要的一点。Db2 pureScale修订包的联机升级是滚动式的联机。当前被维护的节点实例会关闭,但是得益于pureScale集群的高可用性,数据库的服务不会因为单节点当机中断,所以整个集群是联机的。

清单 7. 在更新CF的过程中,CF会被停掉

$ db2instance -list                       
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               PRIMARY                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               STOPPED                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                             YES           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

清单 8. 安装完成后,CF会被重启

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               PRIMARY                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               CATCHUP                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

现在再来查看一下实例的级别。
清单 9. 查看实例级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:06:00 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:51:54 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/21:12:06:01 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Last updated       = 2013/08/29:10:59:30

从db2pd的输出里面可以看到,节点128磁盘上的的体系结构级别(Architecture Level),代码级别(Code Level)都是10.5.0.1。该CF节点已经安装介质已经升级成功。

在此过程中,HADR一直正常工作,不受影响。两个成员节点都处于同步状态。
清单 10. 查看HADR状态

$ db2pd -d TESTDB -hadr                    

Database Member 0 -- Database TESTDB -- Standby -- Up 0 days 00:38:10 -- Date 2013-08-29-11.14.39.971444

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam1
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.778012 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 12
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 4.856
                  LOG_HADR_WAIT_COUNT = 1722447
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710201691
            STANDBY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710201691
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710201691
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/29/2013 11:03:43.000000 (1377745423)
                     STANDBY_LOG_TIME = 08/29/2013 11:03:43.000000 (1377745423)
              STANDBY_REPLAY_LOG_TIME = 08/29/2013 11:03:43.000000 (1377745423)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 1
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam2
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 1
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.765026 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 11
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000010
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 8.904
                  LOG_HADR_WAIT_COUNT = 783810
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
            STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
                     STANDBY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
              STANDBY_REPLAY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

下面开始更新成员1节点。成员0节点是回放节点,1节点是空闲节点。现在先升级非回放节点。

清单 11. 更新member 1节点(非回放节点)

# ./installFixPack -p /opt/IBM/db2/V10.5FP1 -I db2sdin1 -online -l /tmp/installFixPack.log -t /tmp/installFixPack.trc
Db2 installation is being initialized.


Db2 pureScale online update evaluation:
=======================================
Hostname:sitebm2 
Instance name:db2sdin1 
Target Installation path:/opt/IBM/db2/V10.5FP1 
Target Code level         =  Version:10 Release:5 Modification:0 Fixpack:1
Target Architecture level =  Version:10 Release:5 Modification:0 Fixpack:1

TSA version installed on this host : 3.2.2.5 
TSA version present on the media : 3.2.2.5
TSA version after update : 3.2.2.5 

GPFS version installed on the host: 3.5.0.7 
GPFS version present on the media : 3.5.0.7
GPFS version after update : 3.5.0.7 

Total number of tasks to be performed: 6 
Total estimated time for all tasks to be performed: 1954 second(s) 

Task #1 start
Description: Installing Db2 database product binaries  
Estimated time 1485 second(s) 
Task #1 end 

Task #2 start
Description: Stopping the Db2 member on the local host 
Estimated time 10 second(s) 
Task #2 end 

Task #3 start
Description: Stopping the instance on the local host 
Estimated time 10 second(s) 
Task #3 end 

Task #4 start
Description: Updating the Db2 database manager instance configuration 
Estimated time 429 second(s) 
Task #4 end 

Task #5 start
Description: Starting the instance on the local host 
Estimated time 10 second(s) 
Task #5 end 

Task #6 start
Description: Starting the Db2 member on the local host 
Estimated time 10 second(s) 
Task #6 end 

The execution completed successfully.

For more information see the Db2 installation log at 
"/tmp/installFixPack.log".

升级成员节点的过程中,数据库实例也会被重启。重启完成后,集群还是正常状态。

清单 12. 查看实例状态

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               PRIMARY                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               CATCHUP                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

因为这个是非回放节点,所以不会影响HADR功能的正常工作。
清单 13. 查看HADR状态

$ db2pd -d TESTDB -hadr

Database Member 0 -- Database TESTDB -- Standby -- Up 0 days 01:00:36 -- Date 2013-08-29-11.37.05.616596

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam1
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.778012 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 4
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 4.856
                  LOG_HADR_WAIT_COUNT = 1722448
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710202248
            STANDBY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710202248
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000016.LOG, 10578, 1710202248
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/29/2013 11:18:45.000000 (1377746325)
                     STANDBY_LOG_TIME = 08/29/2013 11:18:45.000000 (1377746325)
              STANDBY_REPLAY_LOG_TIME = 08/29/2013 11:18:45.000000 (1377746325)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 1
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam2
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 1
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 10:36:44.765026 (1377743804)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 7
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000010
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 8.904
                  LOG_HADR_WAIT_COUNT = 783810
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
            STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
                     STANDBY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
              STANDBY_REPLAY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

现在再次查看实例级别,观察升级成员与升级CF之间的区别。

清单 14. 查看实例级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Last updated       = 2013/08/21:12:06:00 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   Last updated       = 2013/08/29:11:33:25 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/21:12:06:01 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Last updated       = 2013/08/29:10:59:30  

在这份报告里里面,相对于CF节点,成员节点中多出了当前有效体系结构级别(CEAL)和当前有效代码级别(CECL)这两项。其中CEAL和CECL的值还是10.5.0.0。而磁盘和内存中的体系结构级别(Architecture Level)和代码级别(Code Level)都已经是10.5.0.1。也就是说刚才的升级还没有最终落实。而最终落实是在整个集群的体系结构级别(Architecture Level)和代码级别(Code Level)都升级完成之后。

下面开始升级回放节点。从前面的结果可以看到,升级的过程中实例都是会重启的。所以当前节点的HADR回放功能必然会受到影响。

清单 15. 更新member 0节点(回放节点)

# ./installFixPack -p /opt/IBM/db2/V10.5FP1 -I db2sdin1 -online -l /tmp/installFixPack.log -t /tmp/installFixPack.trc
Db2 installation is being initialized.


Db2 pureScale online update evaluation:
=======================================
Hostname:sitebm1 
Instance name:db2sdin1 
Target Installation path:/opt/IBM/db2/V10.5FP1 
Target Code level         =  Version:10 Release:5 Modification:0 Fixpack:1
Target Architecture level =  Version:10 Release:5 Modification:0 Fixpack:1

TSA version installed on this host : 3.2.2.5 
TSA version present on the media : 3.2.2.5
TSA version after update : 3.2.2.5 

GPFS version installed on the host: 3.5.0.7 
GPFS version present on the media : 3.5.0.7
GPFS version after update : 3.5.0.7 

Total number of tasks to be performed: 6 
Total estimated time for all tasks to be performed: 1954 second(s) 

Task #1 start
Description: Installing Db2 database product binaries  
Estimated time 1485 second(s) 
Task #1 end 

Task #2 start
Description: Stopping the Db2 member on the local host 
Estimated time 10 second(s) 
ask #2 end 

Task #3 start
Description: Stopping the instance on the local host 
Estimated time 10 second(s) 
Task #3 end 

Task #4 start
Description: Updating the Db2 database manager instance configuration 
Estimated time 429 second(s) 
Task #4 end 

Task #5 start
Description: Starting the instance on the local host 
Estimated time 10 second(s) 
Task #5 end 

Task #6 start
Description: Starting the Db2 member on the local host 
Estimated time 10 second(s) 
Task #6 end 

The execution completed successfully.

For more information see the Db2 installation log at 
"/tmp/installFixPack.log".

更新完成后member被重启。
清单 16. 查看实例状态

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               PRIMARY                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF                  PEER                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

现在来看看关注的HADR状态是什么样的。

清单 17. 查看HADR状态

$ db2_all db2pd -d TESTDB -hadr



Database TESTDB not activated on database member 0.

Option -hadr requires -db <database> or -alldbs option and active database.
sitebm1: db2pd -d TESTDB -hadr completed rc=255


Database TESTDB not activated on database member 1.

Option -hadr requires -db <database> or -alldbs option and active database.
sitebm2: db2pd -d TESTDB -hadr completed rc=255

显然HADR已经停掉了。重新激活数据库来启动HADR。
清单 18. 激活数据库,启动HADR

$ db2 activate db TESTDB
Db20000I  The ACTIVATE DATABASE command completed successfully.
$ db2pd -d TESTDB -hadr

清单 19. 查看HADR状态

$ db2pd -d TESTDB -hadr

Database Member 0 -- Database TESTDB -- Standby -- Up 0 days 00:00:27 -- Date 2013-08-29-14.00.49.252057

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam1
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 14:00:35.532316 (1377756035)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 13
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 4.856
                  LOG_HADR_WAIT_COUNT = 1722448
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000016.LOG, 10719, 1710775901
            STANDBY_LOG_FILE,PAGE,POS = S0000016.LOG, 10719, 1710775901
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000016.LOG, 1013, 1671214878
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/29/2013 13:19:02.000000 (1377753542)
                     STANDBY_LOG_TIME = 08/29/2013 13:19:02.000000 (1377753542)
              STANDBY_REPLAY_LOG_TIME = 08/29/2013 11:18:45.000000 (1377746325)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 28
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 1
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam2
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 1
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 14:00:35.488440 (1377756035)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 13
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000010
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 8.904
                  LOG_HADR_WAIT_COUNT = 783810
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
            STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 20572, 1102854083
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
                     STANDBY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
              STANDBY_REPLAY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

HADR恢复正常,两个member节点的赶到了同步的状态。所以可以看到HADR的功能在升级的过程中受到了影响,但是对于数据库服务并没有影响。毕竟只是备集群的HADR功能被停止了。重新启动即可,不会造成数据损失。

清单 20. 查看实例级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   Last updated       = 2013/08/29:11:53:43 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   Last updated       = 2013/08/29:11:33:25 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Last updated       = 2013/08/21:12:06:01 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Last updated       = 2013/08/29:10:59:30

成员0的当前有效体系结构级别(CEAL)和当前有效代码级别(CECL)还是10.5.0.0。而磁盘和内存中的体系结构级别(Architecture Level)和代码级别(Code Level)都已经是10.5.0.1。结果和升级成员1是一样的。最后升级主CF节点。

清单 21. 更新Primary CF节点

# ./installFixPack -p /opt/IBM/db2/V10.5FP1 -I db2sdin1 -online -l /tmp/installFixPack.log -t /tmp/installFixPack.trc
Db2 installation is being initialized.


Db2 pureScale online update evaluation:
=======================================
Hostname:sitebf1 
Instance name:db2sdin1 
Target Installation path:/opt/IBM/db2/V10.5FP1 
Target Code level         =  Version:10 Release:5 Modification:0 Fixpack:1
Target Architecture level =  Version:10 Release:5 Modification:0 Fixpack:1

TSA version installed on this host : 3.2.2.5 
TSA version present on the media : 3.2.2.5
TSA version after update : 3.2.2.5 

GPFS version installed on the host: 3.5.0.7 
GPFS version present on the media : 3.5.0.7
GPFS version after update : 3.5.0.7 

Total number of tasks to be performed: 6 
Total estimated time for all tasks to be performed: 1954 second(s) 

Task #1 start
Description: Installing Db2 database product binaries  
Estimated time 1485 second(s) 
Task #1 end 

Task #2 start
Description: Stopping the cluster caching facility (CF) on the local host 
Estimated time 10 second(s) 
Task #2 end 

Task #3 start
Description: Stopping the instance on the local host 
Estimated time 10 second(s) 
Task #3 end 

Task #4 start
Description: Updating the Db2 database manager instance configuration 
Estimated time 429 second(s) 
Task #4 end 

Task #5 start
Description: Starting the instance on the local host 
Estimated time 10 second(s) 
Task #5 end 

Task #6 start
Description: Starting the cluster caching facility on the local host 
Estimated time 10 second(s) 
Task #6 end 

The execution completed successfully.

更新Primary CF的过程中,实例的重启会造成CF角色的转换。

清单 22. 更新过程中CF被停,CF角色切换

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF               STOPPED                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               PRIMARY                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                             YES           NO
sitebm1              ACTIVE                              NO           NO

清单 23. 更新完成后CF重新加入为Secondary

$ db2instance -list                       
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                sitebm1            sitebm1               NO                  0                   0    sitebm1-ib0,sitebm1-ib1
1       MEMBER           STARTED                sitebm2            sitebm2               NO                  0                   0    sitebm2-ib0,sitebm2-ib1
128     CF                  PEER                sitebf1            sitebf1               NO                  -                   0    sitebf1-ib0,sitebf1-ib1
129     CF               PRIMARY                sitebf2            sitebf2               NO                  -                   0    sitebf2-ib0,sitebf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
sitebm2              ACTIVE                              NO           NO
sitebf2              ACTIVE                              NO           NO
sitebf1              ACTIVE                              NO           NO
sitebm1              ACTIVE                              NO           NO

更新Primary CF的过程中,CF角色的转变并不会影响HADR功能。

清单 24. 查看HADR状态

$ db2pd -d TESTDB -hadr

Database Member 0 -- Database TESTDB -- Standby -- Up 0 days 00:17:03 -- Date 2013-08-29-14.17.25.527888

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 0
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam1
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 0
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 14:00:35.532316 (1377756035)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 5
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000000
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 4.856
                  LOG_HADR_WAIT_COUNT = 1722448
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000016.LOG, 10719, 1710775901
            STANDBY_LOG_FILE,PAGE,POS = S0000016.LOG, 10719, 1710775901
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000016.LOG, 10719, 1710775901
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/29/2013 13:19:02.000000 (1377753542)
                     STANDBY_LOG_TIME = 08/29/2013 13:19:02.000000 (1377753542)
              STANDBY_REPLAY_LOG_TIME = 08/29/2013 13:19:02.000000 (1377753542)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0
             READS_ON_STANDBY_ENABLED = N

                            HADR_ROLE = STANDBY
                          REPLAY_TYPE = PHYSICAL
                        HADR_SYNCMODE = ASYNC
                           STANDBY_ID = 0
                        LOG_STREAM_ID = 1
                           HADR_STATE = PEER
                           HADR_FLAGS = 
                  PRIMARY_MEMBER_HOST = siteam2
                     PRIMARY_INSTANCE = db2sdin1
                       PRIMARY_MEMBER = 1
                  STANDBY_MEMBER_HOST = sitebm1
                     STANDBY_INSTANCE = db2sdin1
                       STANDBY_MEMBER = 0
                  HADR_CONNECT_STATUS = CONNECTED
             HADR_CONNECT_STATUS_TIME = 08/29/2013 14:00:35.488440 (1377756035)
          HEARTBEAT_INTERVAL(seconds) = 15
                HADR_TIMEOUT(seconds) = 60
        TIME_SINCE_LAST_RECV(seconds) = 6
             PEER_WAIT_LIMIT(seconds) = 1
           LOG_HADR_WAIT_CUR(seconds) = 0.000
    LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.000010
   LOG_HADR_WAIT_ACCUMULATED(seconds) = 8.904
                  LOG_HADR_WAIT_COUNT = 783810
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 1048576, 1048352
            PRIMARY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
            STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
                  HADR_LOG_GAP(bytes) = 0
     STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 24189, 1117595246
       STANDBY_RECV_REPLAY_GAP(bytes) = 0
                     PRIMARY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
                     STANDBY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
              STANDBY_REPLAY_LOG_TIME = 08/26/2013 14:03:22.000000 (1377497002)
         STANDBY_RECV_BUF_SIZE(pages) = 512
             STANDBY_RECV_BUF_PERCENT = 0
           STANDBY_SPOOL_LIMIT(pages) = 1000000
                STANDBY_SPOOL_PERCENT = 0
                 PEER_WINDOW(seconds) = 0     
             READS_ON_STANDBY_ENABLED = N

HADR状态没有受到影响。至此HADR备集群的所有节点都已经升级完。

清单 25. 查看实例级别

$ db2pd -rustatus

ROLLING UPDATE STATUS:  Disk Value                                         Memory Value                                      

   Record Type        = INSTANCE 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     Not Applicable
   State              = [NONE] 
   Last updated       = 2013/08/21:12:06:09 


   Record Type        = MEMBER 
   ID                 = 0 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   Last updated       = 2013/08/29:11:53:43 

sitebm1: db2pd -rustatus -localhost ... completed ok

   Record Type        = MEMBER 
   ID                 = 1 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CECL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   CEAL               = V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     V:10 R:5 M:0 F:0 I:0 SB:0 (0x0A05000000000000)     
   Section Level      = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     
   Last updated       = 2013/08/29:11:33:25 

sitebm2: db2pd -rustatus -localhost ... completed ok

   Record Type        = CF 
   ID                 = 128 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Last updated       = 2013/08/29:14:19:56 

   Record Type        = CF 
   ID                 = 129 
   Code Level         = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Architecture Level = V:10 R:5 M:0 F:1 I:0 SB:0 (0x0A05000100000000)     Not Applicable
   Last updated       = 2013/08/29:10:59:30 

至此HADR备集群的所有节点都已经升级完,只是还没有落实下来。在落实之前,可以先检查一下修订包是否可落实。

清单 26. 检查可升级状态

# ./installFixPack -check_commit -p /opt/IBM/db2/V10.5FP1 -I db2sdin1                                                              
DBI1446I  The installFixPack command is running.



The pre-commit verification process for an online fix pack update has started....
The checks for the pre-commit verification process have been completed successfully.

If you perform a commit, the new level will be = 
   Version:10 Release:5 Modification:0 Fixpack:1

The execution completed successfully. 

For more information see the Db2 installation log at "/tmp/installFixPack.log.20185300". 
DBI1070I  Program installFixPack completed successfully.

结果表明当前集群可以被落实到10.5.0.1版本。但是现在先不要落实更新。因为更新落实之后,理论上是不会影响HADR。因为新的修订包通常都会兼容回放以前修订包的日志,但是如果有特殊情况,就有可能影响HADR的同步功能。如果真的会出现这种影响,那用户一定希望将这种影响控制到最小。所以先不落实更新,而是开始滚动升级主集群。

滚动升级主集群

主集群的滚动升级是指在尽量减少对业务正常工作影响的情况下,一个一个的更新主集群的所有节点。在升级的过程中,需要关注Db2 pureScale集群是否正常提供数据库服务,HADR的同步有没有受到影响等。
清单 27. 检查db2level

$ db2level
Db21085I  This instance or install (instance name, where applicable: 
"db2sdin1") uses "64" bits and Db2 code release "SQL10050" with level 
identifier "0601010E".
Informational tokens are "Db2 v10.5.0.0", "s130528", "AIX64105", and Fix Pack 
"0".
Product is installed at "/opt/IBM/db2/V10.5".

主集群的数据库介质安装路径是/opt/IBM/db2/V10.5, 当前版本是"Db2 v10.5.0.0"。 和备集群的升级一样,新的Db2安装包将被安装到/opt/IBM/db2/V10.5FP1路径下。

清单 28. 查看实例状态

$ db2instance -list
ID        TYPE             STATE                HOME_HOST               CURRENT_HOST            ALERT   PARTITION_NUMBER        LOGICAL_PORT    NETNAME
--        ----             -----                ---------               ------------            -----   ----------------        ------------    -------
0       MEMBER           STARTED                siteam1            siteam1               NO                  0                   0    siteam1-ib0,siteam1-ib1
1       MEMBER           STARTED                siteam2            siteam2               NO                  0                   0    siteam2-ib0,siteam2-ib1
128     CF               PRIMARY                siteaf1            siteaf1               NO                  -                   0    siteaf1-ib0,siteaf1-ib1
129     CF                  PEER                siteaf2            siteaf2               NO                  -                   0    siteaf2-ib0,siteaf2-ib1

HOSTNAME                   STATE                INSTANCE_STOPPED        ALERT
--------                   -----                ----------------        -----
siteam2              ACTIVE                              NO           NO
siteaf2              ACTIVE                              NO           NO
siteaf1              ACTIVE                              NO           NO
siteam1              ACTIVE                              NO           NO
$

HADR的状态之前检查已经是PEER的状态。实例检查也处于正常工作的状态。成员都是STARTED,CF也处于PEER状态。下面准备升级集群。

因篇幅较长,本文分上下两篇发布。

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

6

添加新评论0 条评论

Ctrl+Enter 发表

关于TWT  使用指南  社区专家合作  厂商入驻社区  企业招聘  投诉建议  版权与免责声明  联系我们
© 2019  talkwithtrend — talk with trend,talk with technologist 京ICP备09031017号-30