Thursday, April 3, 2025

SAP HANA HA and DR

 SAP HANA HSR provides High Availability and Disaster recovery

Fundamentals of HSR: 

SAP HSR has two fundamental concepts

1. HSR Replication Mode: Synchronous, Synchronous to memory, Asynchronous

2. HSR Operation Modes: Delta shipping, Log replay or log replay with read access

Replication Mode: 

The HSR replication mode determines the behavior of secondary system in acquiring the data from the primary system

1. Synchronous (SYNC)

  • The primary system waits for an acknowledgment from the secondary system before committing transactions.

  • Ensures no data loss.

  • Best for high-availability setups within low-latency environments.

  • Requires a reliable, high-speed network.

2. Synchronous in-memory (SYNCMEM)

  • Ensures zero data loss but only guarantees that data is in the secondary system’s memory (not persisted to disk).

  • Faster than SYNC since it doesn’t wait for disk writes on the secondary system.

  • Suitable for systems with strict uptime requirements.

3. Asynchronous (ASYNC)

  • The primary system does not wait for the secondary system to acknowledge the transaction.

  • Some data loss is possible in case of failure before replication completes.

  • Best for disaster recovery setups over long distances.

4. Synchronous Full Sync (FULLSYNC) [Less Common]

  • Similar to SYNC but ensures the secondary system has fully committed the transaction before acknowledging.

  • Used in rare cases where absolute consistency is critical.

Choosing the Right Mode

  • High availability within a data center?SYNC or SYNCMEM

  • Disaster recovery across regions?ASYNC

  • Extreme data consistency required?FULLSYNC

Operation Mode:

HSR Operation mode determines how the data is sent and processed by the secondary system


1. Delta Data Shipping (operation_mode=delta_datashipping)
This mode establishes a system replication where occasionally (per default every 10 minutes) a delta data shipping takes place in addition to the continuous log shipping. The shipped redo log is not replayed on the secondary site. The log is replayed only when a takeover (failover) occurs or when manually triggered.

2. Continuous Log Replay (operation_mode=logreplay)
This mode does not require a delta data shipping anymore. Additionally, the shipped redo log is continuously replayed on the secondary site.

Log Replay Read Access
The operation mode Log Replay Read Access is identical to the Log Replay mode with the exception that the secondary system is available in read only mode. This means that a SQL query can access (read) the data in the secondary, but the data can't be changed.


Configure HANA Replication:

Reference blog: 

https://www.nexgen-tech.in/2019/01/hana-system-replication-hadr.html

You can configure SAP HANA system replication by using the following tools:
    • SAP HANA cockpit
    • SAP HANA studio
    • `Hdbnsutil` (a command-line tool)

Perform the following steps to configure replication by using SAP HANA studio:

Step one: Enable system replication on the Primary

1. Start the primary system.
2. Perform an initial data backup or storage snapshot on the primary system.
3. Enable system replication on the primary system by using the following steps in SAP HANA studio:
         a. In the Systems view, right-click the primary system and choose
                     Configuration and Monitoring -> Configure System Replication.


sidadm password
Provide logical name for primary system
Finish.

Step 2: Register the secondary System

  Stop the secondary system


Register the secondary system:
 
next

Provide all the details such as : Logical Name, Replication mode, operation mode, primary system hostname and Instance number.

Note: If you want to configure Active-Active Read, then you need to select the operation mode as Logreplay_readaccess. 

Logreplay-readaccess operation mode is not supported in HANA Studio; you should use either the HANA cockpit or the HDBnsutil command-line tool. 

Click on Finish
With this HANA system replication setup completed successfully

Once the secondary system restarts automatically, the replication will begin to start. 

You can monitor the replication from Hana Studio-->Landscape-->System Replication.


Step 3 : Takeover

  • You can trigger the takeover in the event of disaster or testing.
  • Register the former primary system as a new secondary system.

Takeover:
  On secondary system --> config and monitoring--> system replication


Click Finish to complete the takeover.



Register the former primary as secondary: 

Once the former primary comes back online, you need to register it as the secondary to the former secondary.

1. Stop the former primary system
2. Right click on the system ==>Configuration and monitoring ==> Configure Replication
3. Register as secondary system
4. Provide the details such as logical name, replication mode, operation mode, and primary host details.


5.  Check the details you have provided in the below screen and click on Finish to complete the task.

4. Disabling HANA Replication for Maintenance:

1. Stop the secondary system
2. Unregister secondary system from secondary system ==> Unregister secondary
3. stop replication from primary system ==> Disable replication

No comments:

Post a Comment