HANA System Replication (HSR): Architecture, Modes & Step-by-Step Setup
A comprehensive operational handbook for SAP HANA System Replication (HSR), detailing Replication Modes (sync, syncmem, async, full sync), Operation Modes (logreplay, delta_datashipping), hdbnsutil CLI setup, network routing, and takeover/failback procedures.
Core Learning Objectives
- 1.Master the 4 Replication Modes and their network latency vs. data loss trade-offs.
- 2.Understand the 3 Operation Modes, focusing on logreplay and secondary read access.
- 3.Configure HSR from scratch using hdbnsutil commands on primary and secondary nodes.
- 4.Resolve hostname resolution and dedicated replication network routing in global.ini.
- 5.Execute a Planned Takeover and Unplanned Emergency Failover with zero split-brain risk.
Definition & Architectural Rationale
Technical Definition:
SAP HANA System Replication (HSR) is a native high availability and disaster recovery feature that continuously ships transactional redo log buffers and persistence deltas from an active primary HANA system to one or more secondary standby systems.
Why this component exists:
Traditional disk or snapshot replication incurs latency and requires lengthy database startup and crash recovery upon failover. HSR maintains standby database processes actively loaded in memory on the secondary site, reducing failover time (RTO) to seconds while guaranteeing zero data loss (RPO = 0 in sync modes).
Internal Working & Mechanics
Architecture Flow Diagram
Linux Terminal Diagnostics & Operations
Terminal Standard Output (stdout):
nameserver is active, proceeding ... validating topology ... enabling system replication ... system replication successfully enabled.
Terminal Standard Output (stdout):
adding site ... nameserver is not running, proceeding ... updating topology ... registering at remote site site-primary ... site registered successfully.
Terminal Standard Output (stdout):
System Replication State ~~~~~~~~~~~~~~~~~~~~~~~~ mode: PRIMARY site id: 1 site name: SITE_PRI Host Mapping: ~~~~~~~~~~~~~ site-primary -> site-secondary Secondary Sites: ~~~~~~~~~~~~~~~~ site id: 2 site name: SITE_SEC process: hdbnsutil active: YES mode: syncmem operation mode: logreplay mapping: site-primary -> site-secondary status: ACTIVE overall replication status: ACTIVE
Terminal Standard Output (stdout):
nameserver is active, proceeding ... taking over system ... stopping system replication ... resetting topology ... takeover completed successfully.
Troubleshooting & Root Cause Analysis
Production Best Practices & Operational Risks
Mandatory Best Practices
- Always configure a dedicated, non-routed physical replication network (10 GbE+) to prevent replication traffic from contending with application users.
- Use Linux HA cluster managers (SUSE Linux Enterprise High Availability Extension or Red Hat High Availability) with STONITH fencing agents to automate failover and prevent split-brain scenarios.