- December 10, 2025
by Girish Phadake
Inside Data Patrol’s PostgreSQL DR Drill for India’s Leading Pharma Enterprise
Enterprise: A Real-World High Availability & Disaster Recovery Simulation with Repmgr
In modern pharma environments, data availability is directly linked to operational safety, compliance, and productivity. For the number one Indian pharmaceutical company, even a few minutes of downtime can disrupt manufacturing lines, delay quality checks, or impact supply chain commitments.
That’s why this client relies on Data Patrol Technologies to maintain, supervise, and regularly validate their PostgreSQL High Availability (HA) and Disaster Recovery (DR) systems. Our team performs this DR drill every single month, ensuring their database environment remains resilient, predictable, and ready for real-world incidents.
This blog highlights a real DR drill, including screenshots, commands, and insights taken directly from our internal environment, showing exactly how we ensure zero-disruption operations for one of India’s most critical enterprises.
Why DR Drills Are Critical (and Why We Perform Them Monthly)
For enterprise-scale environments, a DR plan isn’t enough. You need to test it.
For the number one Indian pharma company, we perform monthly/quarterly DR drills to validate:
✔ The DR plan actually works end-to-end
Documentation cannot replace live testing.
✔ RTO & RPO meet business expectations
- RTO: How long can systems be down?
- RPO: How much data can be lost?
DR drills give real answers, not assumptions.
✔ Gaps are discovered before they become risks
We identify misconfigurations, delays, bottlenecks, or missing runbook steps early.
✔ The IT team feels confident during real emergencies
Practice builds precision and calmness.
PostgreSQL HA Architecture for the Client
- PostgreSQL Version: 15
- Repmgr Version: 15
- Load Balancer: HAProxy + Keepalived
- Primary Node: UAT1
- DR Standby Node: UAT2
Planned Switchover (UAT1 → UAT2)
A switchover is a planned, zero-data-loss changeover that promotes a standby node to primary.
Our goal was to make UAT2 the new master, validate application connectivity, and then switch back safely.
Part 1: Pre-Switchover Safety Checks
✔ Checking WAL status
ps -ef | grep wal
✔ Replication Status (Primary Node)
select * from pg_stat_replication;
✔ Replication Status (Standby Node)
select * from pg_stat_wal_receiver;
✔ Checking Replication Slots (Primary Node)
select * from pg_replication_slots;
✔ Checking Log Replay Lag (Standby Node)
select pg_is_in_recovery() as is_slave,
pg_last_wal_receive_lsn() AS receive,
pg_last_wal_replay_lsn() as replay,
pg_last_wal_receive_lsn()=pg_last_wal_replay_lsn() as synced,
(extract(epoch from now()) - extract(epoch from pg_last_xact_replay_timestamp()))::int as lag;
✔ Checking Cluster Status Using Repmgr (Both Node)
repmgr -f /etc/repmgr/14/repmgr.conf cluster show
✔ Checking Active Database Connections (Primary Node)
select * from pg_stat_activity where state='active';
✔ Stopping HAProxy & Keepalived for controlled failover (Both Node)
systemctl stop haproxy
systemctl stop keepalived
systemctl status haproxy
systemctl status keepalived
Above validations ensure both nodes are fully synchronized and safe for promotion.
Part 2: Performing the Switchover
repmgr -f /etc/repmgr/15/repmgr.conf standby switchover --dry-run
Actual Switchover
repmgr -f /etc/repmgr/15/repmgr.conf standby switchover
Switchover completed successfully:
UAT1 → UAT2
Part 3: Post-Switchover Validations
✔ Checking Cluster Status (Both Node)
repmgr -f /etc/repmgr/15/repmgr.conf cluster show
✔ Log Gap (New Standby)
select pg_is_in_recovery()...
✔ WAL Activity (New Primary)
ps -ef | grep wal
✔ Replication Slot Status (New Primary)
select * from pg_replication_slots;
✔ Replication Status (New Primary)
select * from pg_stat_replication;
✔ Re-enabling HAProxy & Keepalived (Both Node)
systemctl start haproxy
systemctl start keepalived
✔ Load Balancer Routing Check
psql -h VIP -p 6868
psql -h VIP -p 6869
Checking VIP connection status post switchover with PGAdmin
Conclusion: A Successful Monthly/Quarterly DR Drill
This end-to-end drill—switchover, validation, and switchback—was executed smoothly.
It strengthened not only the client’s DR readiness but also the operational confidence of their IT team.
Key Takeaways
• Preparation is everything
• Always test a dry run
• Automation with repmgr simplifies complex failovers
• Regular DR drills (monthly) are the real secret to enterprise resilience
For the number one Indian pharmaceutical company, Data Patrol Technologies ensures:
• Zero-downtime operations
• High availability
• Disaster-ready database architecture
• Proactive risk mitigation
This is the standard we uphold, every month, without fail.