IBM Db2 for SAP High Availability and Disaster Recovery
Version Control:
Version | Revision Date | Types Of Changes | Effective Date |
---|---|---|---|
1.0 | 2019/3/15 |
This guide shows you how to set up SAP NetWeaver system with IBM Db2 high-availability disaster recovery(HADR) without cluster manager, e.g. TSAMP, on the Linux operation system(SUSE is chosen as an example in this guide, other Unix or Linux operation systems are also supported) on Alibaba cloud.
Solution Overview
Overview
These instructions are targeted for pure IBM Db2 HADR requirement without cluster manager which means manual takeover and failback operation is required.
This implementation uses HAVIP which is a high availability virtual IP service implemented by Alibaba cloud.
These instructions show you how to set up an IBM Db2 HADR for SAP that consists of a SAP application server, a primary IBM Db2 server and one secondary or standby IBM Db2 server, each of which are deployed on a separate ECS(VM). IBM Db2 High-Availability Disaster Recovery (HADR) function is used to replicate logged data changes to the standby database.
Architecture Overview
This document guides you on how to deploy a SAP NetWeaver system with IBM Db2 HADR feature enabled but without cluster manager intra-availability zone or cross-zone. Following is a brief architecture:
IBM Db2 HADR is activated between the two database nodes;
One SAP application node, two Db2 nodes locates in one zone of the same Region;
Alibaba Cloud Specific Virtual IP Resource which can be used to control which Db2 server the SAP application should refer to;
Network Design
In this section, you can find below network design example which can help you understand the implementation.
Physical Hostname | Virtual Hostname | Role | IP1 | VIP |
---|---|---|---|---|
HADRSAP | SAP application | 172.16.1.47 | ||
HADRDB0 | VHADRDB | Db2 | 172.16.1.45 | 172.16.1.1 |
HADRDB1 | VHADRDB | Db2 | 172.16.1.48 | 172.16.1.1 |
Infrastructure Preparation
Infrastructure List
1 VPC network;
3 ECS instances in one zones of the same VPC;
Alibaba Cloud specific virtual IP service called HAVIP
Creating VPC
Creating VPC
First, create a VPC via Console→Virtual Private Cloud→VPCs→Create VPC. In this example, a VPC named SLBS in the Region EU Central 1 (Frankfurt) has been created:
Creating ECS Instances
Two ECS instances are created in one zone of the above created VPC via Console→Elastic Compute Service ECS→Instances→Create Instance. Choose the “SUSE Linux Enterprise Server” image from the public image tab.
In this example, 3 ECS instances (hostname: HADRSAP, HADRDB0 and HADRDB1) are created in eu-central-1 Region zone B, within VPC: SLBS, with SUSE Linux Enterprise Server 12 SP2 image. Host HADRSAP is the SAP application server. Host HADRDB0 is the original primary Db2 node, and HADRDB1 is the original standby node.
Creating HAVIP
High-Availability Virtual IP Address (HAVIP) is a private IP resource which can be created and released independently. The uniqueness of HAVIP is that you can broadcast the IP address on ECS using ARP. In this deployment, the HAVIP is used as the virtual IP address of the Db2 instance and is attached to primary Db2 node.
Create HAVIP
HAVIP is created via Console->VPC->HAVIP->Create HAVIP Address, then assign the VPC and corresponding vswitch which was created before and also the HAVIP address which will be used as virtual IP address. Please kindly refer to below figure for our example:
Configure Network Interface
In order to let the vip take effect, you need to add the HAVIP address as an additional address of your network interface and update /etc/hosts file with vip and vhost information as below.
172.16.1.47 HADRSAP HADRSAP
172.16.1.45 HADRDB0 HADRDB0
172.16.1.48 HADRDB1 HADRDB1
172.16.1.1 VHADRDB VHADRDB
Bind Primary Db2 Node
In the created HAVIP page, attach Db2 node HADRDB0 as primary by clicking “attach” button as below.
Deployment
Environment Preparation
Before deployment, please download required SAP software at SAP Software Center. And also initialize the file system of Db2 servers as mentioned at IBM Db2 for SAP Deployment Guide.
SAP ASCS Instance Installation
If you want to make the SAP central services instance highly available, you must install the instance on a virtual host name. You can do this by using the parameter SAPINST_USE_HOSTNAME when you start the SAP installer.
In this example, since HA feature is not required for SAP central service, you can directly start the installer without hostname parameter.
For more information about the installation, see your relevant installation guide at https://help.sap.com/viewer/30839dda13b2485889466316ce5b39e9/CURRENT_VERSION/en-US/c8ed609927fa4e45988200b153ac63d1.html.
Primary IBM Db2 Instance Installation
Install the database server as described in the appropriate installation guide at https://help.sap.com/viewer/30839dda13b2485889466316ce5b39e9/CURRENT_VERSION/en-US/c8ed609927fa4e45988200b153ac63d1.html.
In our example, since HA is required for the DB instance, therefore please use SAPINST_USE_HOSTNAME=VHADRDB during installation.
Standby IBM Db2 Installation
If you set up the switchover cluster based on the Db2 feature HADR, you have to create a standby database as a copy of the primary database. You can use the SAP homogeneous system copy for setting up the standby database server. For details please kindly refer to IBM Db2 High Availability Solution: IBM Tivoli System Automation for Multiplatforms.
SAP PAS Instance Installation
The installation of SAP application servers is not covered in this document. For more information, see the respective installation guide that you use to install the database server. You can find the installation guides at https://help.sap.com/viewer/30839dda13b2485889466316ce5b39e9/CURRENT_VERSION/en-US/c8ed609927fa4e45988200b153ac63d1.html.
IBM Db2 HADR Configuration
Please refer to Initializing high availability disaster recovery (HADR) for details.
In summary, you need to :
Add HADR service entry in /etc/services file. In our example, we have DB2HADR 5917/tcp into the service file.
Execute command
db2 "UPDATE DB CFG FOR JLD USING LOGINDEXBUILD ON
on both Db2 nodes.HADR configuration
Primary:
db2 "UPDATE DB CFG FOR JLD USING HADR_LOCAL_HOST HADRDB0 HADR_LOCAL_SVC DB2HADR HADR_SYNCMODE NEARSYNC"; db2 "UPDATE DB CFG FOR JLD USING HADR_TARGET_LIST HADRDB1:DB2HADR"; db2 "UPDATE DB CFG FOR JLD USING HADR_REMOTE_HOST HADRDB1 HADR_REMOTE_SVC DB2HADR HADR_REMOTE_INST db2jld";
Standby:
db2 "UPDATE DB CFG FOR JLD USING HADR_LOCAL_HOST HADRDB1 HADR_LOCAL_SVC DB2HADR HADR_SYNCMODE NEARSYNC"; db2 "UPDATE DB CFG FOR JLD USING HADR_TARGET_LIST HADRDB0:DB2HADR"; db2 "UPDATE DB CFG FOR JLD USING HADR_REMOTE_HOST HADRDB0 HADR_REMOTE_SVC DB2HADR HADR_REMOTE_INST db2jld";
Start HADR on both nodes
On host HADRDB1, execute:
Db2 "START HADR ON DB JLD AS STANDBY"
On host HADRDB0, execute:
Db2 "START HADR ON DB JLD AS PRIMARY"
HADR Verification
After you have finished above actions, you should be able to verify the HADR status as below:
From SAP application transaction DBACOCKPIT, you should be able to find out:
Afterwards, you can perform a takeover on current standby Db2, i.e. HADRDB1 and then unbind HADRDB0 in HAVIP and bind HADRDB1 as below:
After all the changes, you should find out that the Database host name in SAP application has changed to HADRDB1 as below: