Bookmark this page

Chapter 3. Explaining SAP HANA System Replication

Abstract

Goal Explain SAP HANA system replication and high availability agents for Pacemaker.
Objectives
  • Plan and set up SAP HANA system replication and automation requirements.

  • Describe, plan, and set up the SAP HANA Scale-up Resource Agent.

  • Describe, plan, and set up the SAP HANA Scale-out Resource Agent and how it differs from the Scale-up Resource Agent.

  • Describe, plan, and set up SAP HANA multitarget system replication on multiple sites and related use cases.

  • Explain a failover in a multitarget system replication environment to demonstrate the general behavior.

Sections
  • Setting up SAP HANA System Replication

  • Installing the SAP HANA Scale-up Resource Agent

  • Installing the SAP HANA Scale-out Resource Agent

  • Installing SAP HANA Scale-out Multitarget System Replication

  • Explaining Failover in the Multitarget System Replication Environment

Setting up SAP HANA System Replication

Objectives

After completing this section, you should be able to plan and set up SAP HANA system replication and automation requirements.

Introduction

SAP HANA system replication continuously synchronizes a HANA database to a secondary location either in the same data center or at a remote site. System replication is a standard SAP HANA feature to ensure the high availability of your SAP HANA system. It is used in Red Hat Enterprise Linux for SAP Solutions: https://access.redhat.com/solutions/3082481. It is used together with Red Hat Solutions for SAP to provide High Availability with several replication modes for SAP HANA system replication.

  • syncmem (default)

  • sync

  • async

For more information, see Replication Modes for SAP HANA System Replication: https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/c039a1a5b8824ecfa754b55e0caffc01.html?version=2.0.02.

The steps to configure SAP HANA System Replication are as follows:

  • Back up the database on the primary node.

  • Stop the secondary database.

  • Copy PKI files to the secondary node, which are required to initialize System Replication.

  • Register the secondary database.

  • Enable system replication on the first node.

  • Start the secondary database.

This section covers the replication of one primary to one secondary node when running a SAP HANA database.

For more information, see SAP HANA System Replication: https://help.sap.com/doc/c81e9406d08046c0a118c8bef71f6bdc/2.0.04/en-US/SAP_HANA_System_Replication_Guide_en.pdf.

Prerequisites for Installing SAP HANA

To use SAP HANA System Replication, you must install on the primary and secondary nodes the same version of the following components:

  • RHEL

  • SAP HANA

  • SID

  • Instance number

To activate SAP HANA system replication, you must have a completed backup.

Parameters for HANA System Replication

Whether you configure SAP HANA System Replication with Ansible or manually, you must specify these parameters:

NameDescriptionExample
node_nameName of the nodehana01
hana_siteName of the location of the HANA instanceDC1
node_roleRole of the nodePrimary or secondary
replicationMode Replication Mode for HANA System Replication: https://bit.ly/3QIvfxi sync or syncmem
operationMode Operation Mode for HANA System Replication: https://bit.ly/3QvWrja delta_datashipping, logreplay, or logreplay_readaccess

Manual Installation Steps

Without Ansible, you can do the following installation steps manually. These steps are also described in Automating SAP HANA Scale-Up System Replication Using the RHEL HA Add-On: https://access.redhat.com/articles/3004101.

  • Set up an operating system instance.

  • Create file systems.

  • Check the subscription and repositories.

  • Prepare the operating system with preconfigured system roles.

  • Verify and update sync hostname resolution.

  • Obtain and download the SAP HANA installation package.

  • Install HANA and use the same SID (System Identifier), instance number, and UID (User ID).

  • Back up the primary database server.

  • Copy PKI files from the primary to the secondary database server.

  • Run the sr_enable command on the primary database server.

  • Run the sr_register command on the secondary database server.

Configure an SAP HANA Database

Assume that you installed an RH1 SAP HANA database on the hana01 and hana02 nodes, both with the instance number 00. Use the following steps to establish SAP HANA system replication:

  • Verify that log_mode is set to normal:

[rh1adm]# hdbsql -u system -p <HANA_SYSTEM_PASSWORD> -i 00 \
> "select value from "SYS"."M_INIFILE_CONTENTS" where key='log_mode'"
VALUE "normal"
1 row selected
  • Back up the primary database on hana01:

[rh1adm@hana01]# hdbsql -i 00 -u system -p <HANA_SYSTEM_PASSWORD> \
> -d SYSTEMDB "BACKUP DATA USING FILE ('/tmp/foo')"
0 rows affected (overall time xx.xxx sec; server time xx.xxx sec)
[rh1adm@hana01]# hdbsql -i 00 -u system -p <HANA_SYSTEM_PASSWORD> \
> *-d SYSTEMDB "BACKUP DATA FOR RH2 USING FILE ('/tmp/foo-RH1')"
0 rows affected (overall time xx.xxx sec; server time xx.xxx sec)
  • Initialize replication on the hana01 primary node:

[rh1adm@]# hdbnsutil -sr_enable --name=DC1
checking for active nameserver ...
nameserver is active, proceeding ...
successfully enabled system as system replication source site
done.
  • Stop the secondary node:

[rh1adm@hana02]# HDB stop
  • Copy the SAP HANA system PKI SSFS_RH2.KEY and SSFS_RH2.DAT files from the primary node to the secondary node:

[rh1adm@hana02]# scp \
> root@hana01:/usr/sap/RH1/SYS/global/security/rsecssfs/key/SSFS_RH1.KEY \
> /usr/sap/RH1/SYS/global/security/rsecssfs/key/SSFS_RH1.KEY
[rh1adm@hana02]# scp \
> root@hana01:/usr/sap/RH1/SYS/global/security/rsecssfs/data/SSFS_RH1.DAT \
> /usr/sap/RH1/SYS/global/security/rsecssfs/data/SSFS_RH1.DAT
  • Register the secondary node:

[rh1adm@hana02]# hdbnsutil -sr_register --remoteHost=node01 \
> --remoteInstance=00 --replicationMode=syncmem --name=DC2
adding site ...
checking for inactive nameserver ...
nameserver node2:30201 not responding.
collecting information ...
updating local ini files ...
done.
  • Start HANA on the secondary node:

[rh1adm@node02]# HDB start
  • Check the status of SAP HANA system replication:

[rh1adm@hana02] hdbnsutil -sr_state
checking for active or inactive nameserver ...

System Replication State
~~~~~~~~
mode: syncmem
site id: 2
site name: DC2
active primary site: 1

Host Mappings:
~~~~~~
hana02 -> [DC1] hana01
hana02 -> [DC2] hana01

If the check is successful as mentioned in the last command, then the HANA system replication is completed successfully.

Revision: rh445-8.4-4e0c572