SAP HANA High Availability Cross-Zone Solution on Alibaba Cloud With SUSE Linux Enterprise Server for SAP Applications

SUSE Linux Enterprise Server for SAP Applications is optimized in various ways for SAP* applications. This document explains how to deploy an SAP HANA High Availability solution cross different Zones on Alibaba Cloud. It is based on SUSE Linux Enterprise Server for SAP Applications 12 SP2. The concept however can also be used with SUSE Linux Enterprise Server for SAP Applications 12 SP3 or newer.

Authors:

  • Jinhui Li, Product Manager SAP Solutions on Alibaba Cloud, AliCloud (Germany)
  • Bernd Schubert, SAP Solution Architect, SUSE

1. Solution Overview

1.1 SAP HANA System Replication

SAP HANA provides a feature called System Replication which is available in every SAP HANA installation. It offers an inherent disaster recovery support.

For details, refer to the SAP Help Portal, HANA system replication:

https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/2.0.03/en-US/b74e16a9e09541749a745f41246a065e.html.

1.2 High Availability Extension Included with SUSE Linux Enterprise Server for SAP Applications

The SUSE High Availability Extension is a high availability solution based on Corosync and Pacemaker. With SUSE Linux Enterprise Server for SAP Applications, SUSE provides SAP specific Resource Agents (SAPHana, SAPHanaTopology etc.) used by Pacemaker. This helps you to build your SAP HANA HA solution up more effectively.

For details, refer to the latest version of the document SAP HANA SR Performance Optimized Scenario at the SUSE documentation web page:

https://www.suse.com/documentation/suse-best-practices.

1.3 Architecture Overview

This document guides you on how to deploy an SAP HANA High Availability (HA) solution cross different Zones. The following list contains a brief architecture overview:

1. The High Availability Extension included with SUSE Linux Enterprise Server for SAP Applications is used to set up the HA Cluster;

2. SAP HANA System Replication is activated between the two HANA nodes;

3. Two HANA nodes are located in different Zones of the same Region;

4. The Alibaba Cloud Specific Virtual IP Resource Agent is used to allow Moving IP automatically switched to Active SAP HANA node; the Alibaba Cloud specific STONITH device is used for fencing.

Alibaba Cloud Architecture — Overview:

Image for post
Image for post

Network Architeture — Overview:

Image for post
Image for post

1.4 Network Design

The following table contains information for the Network design.

Image for post
Image for post

2 Infrastructure Preparation

The next sections contain information about how to prepare the infrastructure.

2.1 Infrastructure List

To set up your infrastructure, the following components are required:

2.2 Creating VPC

First, create a VPC via Console?úVirtual Private Cloud?úVPCs?úCreate VPC. In this example, a VPC named suse_hana_ha in the Region EU Central 1 (Frankfurt) has been created:

Image for post
Image for post

There should be at least two VSwitches (subnets) defined within the VPC network. Each VSwitch should be bound to a different Zone. In this example, the following two VSwitches (subnets) are defined:

  • Switch1 192.168.0.0/24 Zone A, for SAP HANA Primary Node;
  • Switch2 192.168.1.0/24 Zone B, for SAP HANA Secondary Node;
Image for post
Image for post

2.3 Creating ECS Instances

Two ECS instances are created in different Zones of the same VPC via Console?úElastic Compute Service ECS?úInstances?úCreate Instance. Choose the “SUSE Linux Enterprise Server for SAP Applications” image from the Image Market place.

In this example, two ECS instances (hostname: hana0 and hana1) are created in the Region EU Central 1, Zone A and Zone B, within the VPC: suse_hana_ha, with SUSE Linux Enterprise Server for SAP Applications 12 SP2 image from the Image Market Place. Host hana0 is the primary SAP HANA database node, and hana1 is the secondary SAP HANA database node.

Image for post
Image for post

2.4 Creating ENIs and Binding to ECS Instances

Create two ENIs via Console?ú Elastic Compute Service ECS?úNetwork and Security?úENI, and attach one for each ECS instance, for HANA System Replication purposes. Configure the IP addresses of the ENIs to the subnet for HANA System Replication only.

In this example, the ENIs are attached to the ECS instances hana0 and hana1. In addition, the IP addresses are configured as 192.168.0.83 and 192.168.1.246 within the same VSwitches of hana0 and hana1, and put into the VPC: suse_hana_ha

Image for post
Image for post

Meanwhile, within the Guest OS, /etc/hosts should also be configured.

According to the example at hand, run the following two commands on boths sites:

The output looks as follows:

Image for post
Image for post

2.5 Creating NAT Gateway and configure SNAT entry

Now create an NAT Gateway attached to the given VPC. In the example at hand, an NAT Gateway named suse_hana_ha_GW has been created:

Image for post
Image for post

After having creating the NAT Gateway, you need to create a corresponding SNAT entry to allow ECS instances within the VPC to access public addresses on the Internet.

Note
An Alibaba Cloud specific STONITH device and Virtual IP Resource Agent are mandatory for the cluster. They need to access Alibaba Cloud OpenAPI through a public domain.

In the example at hand, two SNAT entries have been created, for ECS instances located in a different network range:

Image for post
Image for post

2.6 Creating STONITH Device and Virtual IP Resource Agent

Download the STONITH fencing software with the following command:

For an HA solution, a fencing device is an essential requirement. Alibaba Cloud provides its own STONITH device, which allows the servers in the HA cluster to shut down the node that is not responsive. The STONITH device leverages Alibaba Cloud OpenAPI underneath the ECS instance, which is similar to a physical reset / shutdown in an on-premise environment.

Image for post
Image for post

Extract the package and install the software.

Image for post
Image for post

Install Alibaba Cloud OpenAPI SDK.

Image for post
Image for post

Configure Alibaba Cloud OpenAPI SDK and Client.

Image for post
Image for post

Get your Access Key as shown below:

Image for post
Image for post

3 Software Preparation

The next sections contain information about the required software.

3.1 Software List

The following software must be available: — SUSE Linux Enterprise Server for SAP Applications 12 SP2 — HANA Installation Media — SAP Host Agent Installation Media

3.2 High Availability Extension Installation

Both ECS instances are created with the SUSE Linux Enterprise Server for SAP Applications image. On both ECS instances, the High Availability Extension (with the major software components: Corosync and Pacemaker), and the package SAPHanaSR should be installed. To do so, you can use zypper.

First, install the pattern High Availability Extension on both nodes:

Now, install the Resource Agents for controlling the SAP HANA system replication on both cluster nodes:

3.3 SAP HANA Installation

Next, install the SAP HANA software on both ECS instances. Make sure the SAP HANA SID and Instance Number are the same (this is required by SAP HANA System Replication). It is recommended to use hdblcm to do the installation. For details refer to the SAP HANA Server Installation and Update Guide at https://help.sap.com/viewer/2c1988d620e04368aa4103bf26f17727/2.0.03/en-US.

In the example at hand, both node are installed with SAP HANA (Rev. 2.00.030.00), and SID: JL0, Instance Number: 00.

Image for post
Image for post

3.4 SAP Host Agent Installation

When you have finished the HANA installation with hdblcm as mentioned above, the SAP Host Agent should already be installed on your server. To install it manually, refer to the article Installing SAP Host Agent Manually: https://help.sap.com/saphelp_nw73ehp1/helpdata/en/8b/92b1cf6d5f4a7eac40700295ea687f/content.htm?no_cache=true.

Check the SAP Host Agent status after you have installed SAP HANA with hdblcm on hana0 and hana1:

Image for post
Image for post

4 Configuring SAP HANA System Replication

The following sections detail how to configure SAP HANA System Replication.

4.1 Backing up SAP HANA on Primary ECS Instance

To do a backup on SAP HANA, you can either use SAP HANA studio or hdbsql as the client command tool.

The backup command is

For HANA 1 single container mode:

For HANA 2 with multitenant as default mode (You should back up systemDB and all tenantDB as shown below in the example):

Command line example:

In this example for HDB Studio, the SAP HANA database backup is executed on both ECS instances as shown below:

Image for post
Image for post

4.2 Configuring SAP HANA System Replication on Primary Node

Log on to the primary node with: su — adm. [sidadm] should be replaced by your SAP HANA database SID. In our example it is su — jl0adm;

Stop HANA with: HDB stop.

Change the following file content:

Add the following content:

[IP] should be the address of the ENI (heartbeat IP address for SAP HANA system replication) attached to the Secondary node;

[HOSTNAME] should be the hostname of the Secondary node;

In the example at hand, the configuration is as follows:

4.3 Configuring SAP HANA System Replication on Secondary Node

Perform the same steps as outlined above for the Primary node on the Secondary node. However, do not forget to use here the IP and hostname of the Primary node instead of the Secondary node.

In the example at hand, the configuration is as follows:

4.4 Enable SAP HANA System Replication on Primary Node

Log on to the primary node with: su — adm;

Start HANA with: HDB start;

Enable System Replication with:

[primary location name] should be replaced by the location of your primary SAP HANA node.

For the example at hand, the following command is used:

Note

All of the above operations are done on the Primary node.

4.5 Register the Secondary Node to the Primary SAP HANA Node

Log on to the secondary node with: su — adm;

Stop SAP HANA with: HDB stop;

Register the Secondary SAP HANA node to the Primary SAP HANA node by running the following command:

For the example at hand, the following command is used:

Start SAP HANA with: HDB start;

Verify the System Replication Status with the following command:

In the example at hand, the following status is displayed on the secondary SAP HANA node hana1:

Image for post
Image for post

Note

All of the above operations are done on the Secondary node.

5 Configuring High Availability Extension for SAP HANA

5.1 Configuration of Corosync

It is recommended that you add more redundancy for messaging (Heartbeat) by using separate ENIs attached to the ECS instances with a separate network range.

On Alibaba Cloud, it is strongly suggested to only use Unicast for the transport setting in Corosync.

Follow the steps below to configure Corosync:

  • Create Keys

Run corosync-keygen on the Primary SAP HANA node. The generated key will be located in the file: /etc/corosync/authkey.

In the example at hand, the command is executed on hana1:

Image for post
Image for post
  • Configure /etc/corosync/corosync.conf as root on the Primary SAP HANA node with the following content:

IP-address-for-heart-beating-for-the-current-server should be replaced by the IP address of the current server, used for messaging (heartbeat) or SAP HANA System Replication. In the example at hand, the IP address of ENI of the current node (192.168.0.83 for hana0 and 192.168.1.246 for hana1) is used.

Note

This value will be different on Primary and Secondary node. The nodelist directive is used to list all nodes in the cluster.

ip-node-1 and ip-node-2 should be replaced by the IP addresses of the ENIs attached to ECS instances for Heartbeat purpose or HANA System Replication purpose. In the example at hand, it should be 192.168.0.83 for hana0 and 192.168.1.246 for hana1.

After completing the editing of /etc/corosync/corosync.conf on the Primary HANA node, copy the files /etc/corosync/authkey and /etc/corosync/corosync.conf to /etc/corosync on the Secondary SAP HANA node with the following command:

In the example at hand, the following command is executed:

Image for post
Image for post

After you have copied the corosync.conf to the Secondary node, configure the bindnetaddr as above to the local heart beating IP address.

5.2 Configuration of Pacemaker

For the SAP HANA High Availability solution, you need to configure seven resources and the corresponding constraints in Pacemaker.

Note

The following Pacemaker configuration only needs to be done on one node. It is usually done on the Primary node.

5.2.1 Cluster Bootstrap and More

Add the configuration of the bootstrap and default setting of the resource and operations to the cluster. Save the following scripts in a file: crm-bs.txt.

Execute the command below to add the setting to the cluster:

5.2.2 STONITH Device

This part defines the Aliyun STONITH devices in the cluster.

Save the following scripts in a file: crm-stonith.txt.

Be sure to implement the following changes:

  • [secondary node hostname] / [primary node hostname] should be replaced by the real hostname of your Secondary node.
  • [secondary node instance id] / [secondary node instance id] should be replaced by the real instance-id of your Secondary node. You can get this from the console.
  • [access key] should be replaced with real access key.
  • [secret key] should be replaced with real secret key.
  • [region] should be replaced with real region name where the node is located.

Execute the command below to add the resource to the cluster:

5.2.3 SAPHanaTopology

This part defines an SAPHanaTopology RA, and a clone of the SAPHanaTopology on both nodes in the cluster. Save the following scripts in a file: crm-saphanatop.txt.

Be sure to implement the following changes:

  • [SID] should be replaced by the real SAP HANA SID.
  • [instance number] should be replaced by the real SAP HANA Instance Number.

Execute the command below to add the resources to the cluster:

5.2.4 SAPHana

This part defines an SAPHana RA, and a multi-state resource of SAPHana on both nodes in the cluster. Save the following scripts in a file: crm-saphana.txt.

Be sure to implement the following changes:

  • [SID] should be replaced by the real SAP HANA SID.
  • [instance number] should be replaced by the real SAP HANA Instance Number.

Execute the command below to add the resources to the cluster:

5.2.5 Virtual IP

This part defines a Virtual IP RA in the cluster. Save the following scripts in a file: crm-vip.txt.

Be sure to implement the following changes:

  • [virtual_IP4_address] should be replaced by the real IP address you prefer to provide the service.
  • [route_table_ID] should be replaced by the route table ID of your VPC.
  • [SID] should be replaced by the real SAP HANA SID.
  • [instance number] should be replaced by the real SAP HANA Instance Number.

Execute the command below to add the resource to the cluster:

5.2.6 Constraints

Two constraints are organizing the correct placement of the virtual IP address for the client database access and the start order between the two resource agents SAPHana and SAPHanaTopology. Save the following scripts in a file: crm-constraint.txt.

Be sure to implement the following changes:

  • [SID] should be replaced by the real SAP HANA SID;
  • [instance number] should be replaced by the real SAP HANA Instance Number;

Execute the command below to add the resource to the cluster:

5.3 Check the Cluster Status

Start the SAP HANA High Availability Cluster on both nodes:

Monitor the SAP HANA High Availability Cluster with the following commands:

In the example at hand, the result looks as follows:

Image for post
Image for post

Meanwhile, check if a new entry [virtual_IP4_address] is added into the route table of the VPC.

In the example at hand, the following result is shown:

Image for post
Image for post

5.4 Verify the High Availability Takeover

Shut down the primary node.

Check the status of Pacemaker as shown below:

Image for post
Image for post

Compare the entry of the route table in the VPC as shown below:

Image for post
Image for post

6 Example

6.1 Example of Cluster Configuration

You can check the cluster configuration via the command crm configure show. For the example at hand, the cluster configuration should display the following content:

6.2 Example of /etc/corosync/corosync.conf

For the example at hand, the corosync.conf on hana1 should display the following content:

7. Reference

  1. Pacemaker 1.1 Configuration Explained https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1.1/html/Pacemaker_Explained/.
  2. SAP HANA SR Performance Optimized Scenario https://www.suse.com/media/white-paper/suse_linux_enterprise_server_for_sap_applications_12_sp1.pdf.
  3. SAP HANA system replication — SAP Help Portal https://help.sap.com/viewer/6b94445c94ae495c83a19646e7c3fd56/2.0.03/en-US/b74e16a9e09541749a745f41246a065e.html.
  4. SAP Applications on Alibaba Cloud: Supported Products and IaaS VM Types https://launchpad.support.sap.com/#/notes/2552731

Source: https://www.suse.com/documentation/suse-best-practices/singlehtml/SLES4SAP-hana-sr-guide-PerfOpt-12-Alicloud/SLES4SAP-hana-sr-guide-PerfOpt-12-Alicloud.html

Reference:https://www.alibabacloud.com/blog/sap-hana-high-availability-cross-zone-solution-on-alibaba-cloud-with-suse-linux-enterprise-server-for-sap-applications_594488?spm=a2c41.12584288.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store