(… パート 2 からの続きです)
DR ノードのドロップは、プライマリー RMA から 3 つのステップで行います。
1.DR へのデータベースレプリケーションをドロップします。
1> sap_disable_replication Toronto, Offsite, tpcc
2> go
TASKNAME TYPE VALUE
------------------- ----------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------
Disable Replication Start Time Thu Dec 08 21:54:47 UTC 2022
Disable Replication Elapsed Time 00:00:45
DisableReplication Task Name Disable Replication
DisableReplication Task State Completed
DisableReplication Short Description Disable the flow of Replication
DisableReplication Long Description Successfully disabled Replication for database 'tpcc'. Please execute 'sap_enable_replication Toronto, Offsite, tpcc' to enable replication for database.
DisableReplication Task Start Thu Dec 08 21:54:47 UTC 2022
DisableReplication Task End Thu Dec 08 21:55:32 UTC 2022
DisableReplication Hostname primarynode.openstack.na-ca-1.cloud.sap
(9 rows affected)
1>
2.HADR システムから DR ノードを削除します。
1> sap_update_replication remove Offsite
2> go
TASKNAME TYPE VALUE
------------------ ----------------- ---------------------------------------------------------------------------
Update Replication Start Time Thu Dec 08 21:57:52 UTC 2022
Update Replication Elapsed Time 00:01:54
UpdateReplication Task Name Update Replication
UpdateReplication Task State Completed
UpdateReplication Short Description Update configuration for a currently replicating site.
UpdateReplication Long Description Update replication request to remove host 'Offsite' completed successfully.
UpdateReplication Task Start Thu Dec 08 21:57:52 UTC 2022
UpdateReplication Task End Thu Dec 08 21:59:46 UTC 2022
UpdateReplication Hostname primarynode.openstack.na-ca-1.cloud.sap
(9 rows affected)
3.DR ホストへのレプリケーションの定義をクリーンアップします。
1> sap_drop_host Offsite
2> go
TASKNAME TYPE VALUE
----------- ----------------- --------------------------------------------------------------------
Drop Host Start Time Thu Dec 08 22:03:12 UTC 2022
Drop Host Elapsed Time 00:00:01
DropHostApi Task Name Drop Host
DropHostApi Task State Completed
DropHostApi Short Description Drop the logical host from the environment.
DropHostApi Long Description Submission of the design change for a model property was successful.
DropHostApi Task Start Thu Dec 08 22:03:12 UTC 2022
DropHostApi Task End Thu Dec 08 22:03:13 UTC 2022
DropHostApi Hostname primarynode.openstack.na-ca-1.cloud.sap
(9 rows affected)
これで DR ホストが HADR 環境から削除されました。
1> sap_status path
2> go
PATH NAME VALUE INFO
--------------------- ------------------------- ----------------------- ------------------------------------------------------------------------------------
Start Time 2022-12-08 22:03:50.498 Time command started executing.
Elapsed Time 00:00:00 Command execution time.
London Hostname companionnode Logical host name.
London HADR Status Standby : Inactive Identify the primary and standby sites.
London Synchronization Mode Synchronous The configured Synchronization Mode value.
London Synchronization State Inactive Synchronization Mode in which replication is currently operating.
London Distribution Mode Remote Configured value for the distribution_mode replication model property.
London Replication Server Status Active The status of Replication Server.
Toronto Hostname primarynode Logical host name.
Toronto HADR Status Primary : Active Identify the primary and standby sites.
Toronto Synchronization Mode Synchronous The configured Synchronization Mode value.
Toronto Synchronization State Synchronous Synchronization Mode in which replication is currently operating.
Toronto Distribution Mode Remote Configured value for the distribution_mode replication model property.
Toronto Replication Server Status Active The status of Replication Server.
London.Toronto.DEM State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.DEM Latency Time Unknown No latency information for database 'DEM'.
London.Toronto.DEM Latency Unknown No latency information for database 'DEM'.
London.Toronto.DEM Commit Time Unknown No last commit time for the database 'DEM'.
London.Toronto.DEM Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.DEM Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.master State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.master Latency Time Unknown No latency information for database 'master'.
London.Toronto.master Latency Unknown No latency information for database 'master'.
London.Toronto.master Commit Time Unknown No last commit time for the database 'master'.
London.Toronto.master Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.master Drain Status Unknown The drain status of the transaction logs of the primary database server.
London.Toronto.tpcc State Suspended Path is suspended (Replication Agent Thread). Transactions are not being replicated.
London.Toronto.tpcc Latency Time Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Latency Unknown No latency information for database 'tpcc'.
London.Toronto.tpcc Commit Time Unknown No last commit time for the database 'tpcc'.
London.Toronto.tpcc Distribution Path Toronto The path of Replication Server through which transactions travel.
London.Toronto.tpcc Drain Status Unknown The drain status of the transaction logs of the primary database server.
Toronto.London.DEM State Active Path is active and replication can occur.
Toronto.London.DEM Latency Time 2022-12-06 18:47:31.278 Time latency last calculated
Toronto.London.DEM Latency 379 Latency (ms)
Toronto.London.DEM Commit Time 2022-12-06 18:47:31.284 Time last commit replicated
Toronto.London.DEM Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.DEM Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.master State Active Path is active and replication can occur.
Toronto.London.master Latency Time 2022-12-06 18:47:31.286 Time latency last calculated
Toronto.London.master Latency 383 Latency (ms)
Toronto.London.master Commit Time 2022-12-06 18:47:31.286 Time last commit replicated
Toronto.London.master Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.master Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
Toronto.London.tpcc State Active Path is active and replication can occur.
Toronto.London.tpcc Latency Time 2022-12-06 18:47:31.286 Time latency last calculated
Toronto.London.tpcc Latency 383 Latency (ms)
Toronto.London.tpcc Commit Time 2022-12-06 19:33:53.846 Time last commit replicated
Toronto.London.tpcc Distribution Path London The path of Replication Server through which transactions travel.
Toronto.London.tpcc Drain Status Not Applicable The drain status of the transaction logs of the primary database server.
(50 rows affected)
これは、isql で DR ノードに接続することでも確認できます。
1> sp_configure 'HADR mode'
2> go
Parameter Name Default Memory Used Config Value Run Value Unit Type
---------------- ----------- ------------- -------------- ------------ -------------- -------
HADR mode -1 0 -1 -1 not applicable dynamic
(1 row affected)
Run Value の値が「-1」となっているのは、このインスタンスがもうどの HADR 環境にも参加していないことを示しています。
Replication Management Agent (RMA) インスタンスはまだ稼働しています。SAP Replication Server (SRS) インスタンスはシャットダウンし削除されています。
データベースを他の目的で使用する場合には、さらなるクリーンアップが可能です。このステップはマニュアル「HADR システムからの DR ノードの削除」(英語)にまとめられています。それ以外の場合は、ノードのクリーンアップとインスタンスを再作成してから DR ノードを HADR クラスターに追加してテストしてください。
ASE インスタンスを再度使用するのではなく、再設定して再度 DR ノードを追加する場合、以下のステップで DR ノードをクリーンアップすることも可能です。
パート1の「DR ノードの追加」を使用して新しい DR インスタンスを追加できるようになりました。
HADR クラスターをチェックする
テストアプリケーションを実行すると、プライマリー(アクティブ)とコンパニオン(スタンバイ)の両方で同じ数のレコードが得られます。
1> use tpcc
2> go
1> select count(*) from ORDER_LINE
2> go
-----------
900695
(1 row affected)
しかし、DR ノードはすでにクラスターの一部ではなくなっているため、カウントは以前にレポートされたものと同じです。
進める前に、HADR システムのシャットダウンとスタートアップを実行します。これは、マニュアルの「HADR システムの開始と停止」 (英語)に記載されています。以下のステップで構成されており、アクティブな ASE がプライマリーノードにあると仮定しています。
シャットダウンの順序
スタートアップの順序
フェールオーバーに必要なのは2つのコマンドのみです。
1> sap_failover Toronto, London, 120
2> go
TASKNAME TYPE VALUE
-------------- --------------------- ----------------------------------------------------------------------------------------------------------
Failover Start Time Fri Dec 09 17:24:05 UTC 2022
Failover Elapsed Time 00:00:02
DRExecutorImpl Task Name Failover
DRExecutorImpl Task State Running
DRExecutorImpl Short Description Failover makes the current standby ASE as the primary server.
DRExecutorImpl Long Description Started task 'Failover' asynchronously.
DRExecutorImpl Additional Info Please execute command 'sap_status task' to determine when task 'Failover' is complete.
Failover Task Name Failover
Failover Task State Running
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Waiting for markers that verify all in-flight data has been sent from source 'Toronto' to target 'London'.
Failover Current Task Number 6
Failover Total Number of Tasks 18
Failover Task Start Fri Dec 09 17:24:05 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap
(15 rows affected)
1> sap_status task
2> go
TASKNAME TYPE VALUE
---------- --------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------
Status Start Time Fri Dec 09 17:24:05 UTC 2022
Status Elapsed Time 00:00:04
Failover Task Name Failover
Failover Task State Completed
Failover Short Description Failover makes the current standby ASE as the primary server.
Failover Long Description Failover from source 'Toronto' to target 'London' is complete. The target may be unquiesced.
Failover Additional Info Please run command 'sap_host_available Toronto' to complete disabling replication from the old source, now that the target 'London' is the new primary.
Failover Current Task Number 14
Failover Total Number of Tasks 14
Failover Task Start Fri Dec 09 17:24:05 UTC 2022
Failover Task End Fri Dec 09 17:24:09 UTC 2022
Failover Hostname primarynode.openstack.na-ca-1.cloud.sap
(12 rows affected)
1> sap_host_available Toronto
2> go
TASKNAME TYPE VALUE
------------- --------------------- -------------------------------------------------------------------------------------------------------
HostAvailable Start Time Fri Dec 09 17:24:47 UTC 2022
HostAvailable Elapsed Time 00:01:44
HostAvailable Task Name HostAvailable
HostAvailable Task State Completed
HostAvailable Short Description Resets the original source logical host when it is available after failover.
HostAvailable Long Description Completed the reset process of logical host 'Toronto' receiving replication from logical host 'London'.
HostAvailable Current Task Number 11
HostAvailable Total Number of Tasks 11
HostAvailable Task Start Fri Dec 09 17:24:47 UTC 2022
HostAvailable Task End Fri Dec 09 17:26:31 UTC 2022
HostAvailable Hostname primarynode.openstack.na-ca-1.cloud.sap
(11 rows affected)
これで、HADR プライマリーとコンパニオンのみのクラスターに戻りました。
将来のブログでは、Fault Manager の使用、計画外のフェールオーバー、HA 対応のアプリケーションの構築などについて触れたいと思います。