(O+P)ut

アウトプット



(O+P)ut

エンジニアのアウトプット

【Db2】db2haicuで設定した自動テイクオーバーを確認する 

スポンサーリンク

はじめに

スタンバイ側にてdb2haicuを実施した後に

プライマリーでも同設定を行い、機能検証としてプライマリー側のOSをシャットダウンしてみました。

環境情報
  • IBM Tivoli System Automation for Multiplatforms 4
  • DB2 v11.5
  • RHEL 7

Primary側の手順

db2haicuを対話モードで実行し、Sutandby側と同じクラスターとDB名を指定します。

$ db2haicu
...
The following are valid settings for the high availability configuration parameter:
  1.TSA
  2.Vendor
Enter a value for the high availability configuration parameter: [1]
1
Setting a high availability configuration parameter for instance 'db2inst1' to 'TSA'.
Adding DB2 database partition '0' to the cluster ...
Adding DB2 database partition '0' to the cluster was successful.
Do you want to validate and automate HADR failover for the HADR database 'SAMPLE'? [1]
1. Yes
2. No
1
Adding HADR database 'SAMPLE' to the domain ...
Adding HADR database 'SAMPLE' to the domain was successful.
Do you want to configure mount point monitoring for the HADR database 'SAMPLE'? [2]
1. Yes
2. No
1
Adding mount point monitoring for HADR database 'SAMPLE' ...
Mount point monitoring for HADR database 'SAMPLE' could not be enabled due to a file system being ineligible for HA.
Adding mount point monitoring for HADR database 'SAMPLE' was unsuccessful.
All cluster configurations have been completed successfully. db2haicu exiting ...

するとクラスター名とは入力ぜすともリソースグループとして確認が可能です。

# lssam
Online IBM.ResourceGroup:db2_db2inst1_db2inst1_SAMPLE-rg Nominal=Online
        '- Online IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs
                |- Online IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs:server1
                '- Offline IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs:server2
Online IBM.ResourceGroup:db2_db2inst1_server1_0-rg Nominal=Online
        '- Online IBM.Application:db2_db2inst1_server1_0-rs
                '- Online IBM.Application:db2_db2inst1_server1_0-rs:server1
Online IBM.ResourceGroup:db2_db2inst1_server2_0-rg Nominal=Online
        '- Online IBM.Application:db2_db2inst1_server2_0-rs
                '- Online IBM.Application:db2_db2inst1_server2_0-rs:server2
Online IBM.Equivalency:db2_db2inst1_db2inst1_SAMPLE-rg_group-equ
        |- Online IBM.PeerNode:server1:server1
        '- Online IBM.PeerNode:server2:server2
Online IBM.Equivalency:db2_db2inst1_server1_0-rg_group-equ
        '- Online IBM.PeerNode:server1:server1
Online IBM.Equivalency:db2_db2inst1_server2_0-rg_group-equ
        '- Online IBM.PeerNode:server2:server2

上記はPrimaryの結果ですが、Standbyでもこのように見えます。

自動テイクオーバーの確認

この状態でPrimary側のOSのシャットダウンを行うとStandby側から見ると

# lssam
Pending online IBM.ResourceGroup:db2_db2inst1_db2inst1_SAMPLE-rg Control=MemberInProblemState Nominal=Online
        '- Offline IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs Control=MemberInProblemState
                |- Failed offline IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs:server1 Node=Offline
                '- Offline IBM.Application:db2_db2inst1_db2inst1_SAMPLE-rs:server2
Failed offline IBM.ResourceGroup:db2_db2inst1_server1_0-rg Nominal=Online
        '- Failed offline IBM.Application:db2_db2inst1_server1_0-rs
                '- Failed offline IBM.Application:db2_db2inst1_server1_0-rs:server1 Node=Offline
Online IBM.ResourceGroup:db2_db2inst1_server2_0-rg Nominal=Online
        '- Online IBM.Application:db2_db2inst1_server2_0-rs
                '- Online IBM.Application:db2_db2inst1_server2_0-rs:server2
Online IBM.Equivalency:db2_db2inst1_db2inst1_SAMPLE-rg_group-equ
        |- Offline IBM.PeerNode:server1:server1 Node=Offline
        '- Online IBM.PeerNode:server2:server2
Online IBM.Equivalency:db2_db2inst1_server1_0-rg_group-equ
        '- Offline IBM.PeerNode:server1:server1 Node=Offline
Online IBM.Equivalency:db2_db2inst1_server2_0-rg_group-equ
        '- Online IBM.PeerNode:server2:server2

プライマリー側がオフラインになったことを検知して自動的にプライマリーへ昇格します。

$ db2pd -db sample -hadr
Database Member 0 -- Database SAMPLE -- Active --...
                            HADR_ROLE = PRIMARY
...

クライアント側からも代替サーバ設定が入っていれば接続先変更をせずにDBアクセスが可能です。

終わりに

DB2の高可用性インスタンス構成ユーティリティー (db2haicu) を利用し、HADRの切り替えを自動で行う流れの検証を行いました。

以上、ご参考になれば幸いです。