首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

筹建简单的DB2 HADR

2012-07-25 
搭建简单的DB2 HADR简单的HADR,只用一台虚拟机,两个实例间搭建。工作量不大,一般5分钟左右能够完成。步骤:1.

搭建简单的DB2 HADR
简单的HADR,只用一台虚拟机,两个实例间搭建。工作量不大,一般5分钟左右能够完成。
步骤:
1.设定归档模式
2.使用备份建立standby数据库
3.设定hadr相关的参数
4.启动并测试



3.设定hadr相关的参数
--先启动standby--在Standby:[db2inst5@localhost ~]$ db2 start hadr on db sample as standbyDB20000I  The START HADR ON DATABASE command completed successfully.--这时候应该是remote catchup pending的状态:[db2inst5@localhost ~]$ db2pd -d sample -hadrDatabase Partition 0 -- Database SAMPLE -- Standby -- Up 0 days 00:03:44HADR Information:Role    State                SyncMode HeartBeatsMissed   LogGapRunAvg (bytes)Standby RemoteCatchupPending Sync     0                  1                   ConnectStatus ConnectTime                           Timeout   Disconnected  Sat Apr 30 14:09:54 2011 (1304143794) 3         PeerWindowEnd                         PeerWindowNull (0)                              120       LocalHost                                LocalService      127.0.0.1                                41099             RemoteHost                               RemoteService      RemoteInstance    127.0.0.1                                42099              db2inst4          PrimaryFile  PrimaryPg  PrimaryLSN        S0000000.LOG 0          0x0000000002AC24A1StandByFile  StandByPg  StandByLSN         StandByRcvBufUsedS0000000.LOG 0          0x0000000002AC24A1 0%  --再启动Primary--在Primary:[db2inst4@localhost ~]$ db2 start hadr on database sample as primaryDB20000I  The START HADR ON DATABASE command completed successfully.[db2inst4@localhost ~]$ db2pd -d sample -hadrDatabase Partition 0 -- Database SAMPLE -- Active -- Up 0 days 00:00:15HADR Information:Role    State                SyncMode HeartBeatsMissed   LogGapRunAvg (bytes)Primary Peer                 Sync     0                  0                   ConnectStatus ConnectTime                           Timeout   Connected     Sat Apr 30 14:14:14 2011 (1304144054) 3         PeerWindowEnd                         PeerWindowSat Apr 30 14:16:26 2011 (1304144186) 120       LocalHost                                LocalService      127.0.0.1                                42099             RemoteHost                               RemoteService      RemoteInstance    127.0.0.1                                41099              db2inst5          PrimaryFile  PrimaryPg  PrimaryLSN        S0000002.LOG 0          0x0000000003288861StandByFile  StandByPg  StandByLSN        S0000002.LOG 0          0x0000000003288861--可以看到一旦Primary也起来了,hadr的状态就会变成peer--这时候尝试手动归档,看日志是否能够顺利传递到standby[db2inst4@localhost ~]$ db2 archive log for DB sampleDB20000I  The ARCHIVE LOG command completed successfully.--在Standby观察[db2inst5@localhost ~]$ db2pd -d sample -hadrDatabase Partition 0 -- Database SAMPLE -- Standby -- Up 0 days 00:05:25HADR Information:Role    State                SyncMode HeartBeatsMissed   LogGapRunAvg (bytes)Standby Peer                 Sync     0                  0                   ConnectStatus ConnectTime                           Timeout   Connected     Sat Apr 30 14:14:14 2011 (1304144054) 3         PeerWindowEnd                         PeerWindowSat Apr 30 14:17:18 2011 (1304144238) 120       LocalHost                                LocalService      127.0.0.1                                41099             RemoteHost                               RemoteService      RemoteInstance    127.0.0.1                                42099              db2inst4          PrimaryFile  PrimaryPg  PrimaryLSN        S0000003.LOG 0          0x000000000366BA41StandByFile  StandByPg  StandByLSN         StandByRcvBufUsedS0000003.LOG 0          0x000000000366BA41 0%  --两边当前日志都是S0000003.LOG,测试成功

热点排行