Part 1: Elasticsearch DR the Hard Way: Hourly Snapshots, NAS Replication, and a Huge Lag
A few years back, Elasticsearch disaster recovery worked like this: two datacenters, an active cluster and a passive one, each with their data nodes and masters, serving an application that loaded and searched a handful of index families. There was no cross-cluster replication. The passive site was kept current by snapshots, filesystem replication, and cron. This series covers what I learned…
In the early days of Elasticsearch disaster recovery, the process relied on two data centers with active and passive clusters, each containing data nodes and masters serving an application that loaded and searched a handful of index families. No cross-cluster replication was in place, and the passive site was kept current through snapshots, filesystem replication, and cron jobs. This series details the transition from snapshot-based disaster recovery (DR) to two-way replication, including unexpected challenges.
Initially, snapshots were taken hourly on the primary cluster, with Curator jobs handling the distribution of snapshots to a shared-filesystem repository on an NFS export NAS. The NAS replicated snapshots periodically, shipping them incrementally to the DR data center. The same repository was registered at the DR site, read-only, and DR would restore hourly snapshots, offset from the primary's schedule.
A second Curator job restored the latest successful snapshot and reopened the indices. Though the setup appeared clean on paper, production showed gaps between components, resulting in an hourly lag that compromised the recovery point and led to a passive cluster unable to serve reads. The storage also grew with each snapshot, and restoring over existing indices required closing them.
Curator jobs occasionally failed, and NAS replication was hard to monitor, with missed hours only becoming apparent in the next hourly cycle. Restoration proved to be a weekend-long process, requiring a detailed 18-step runbook to switch sites. Security indices also needed separate hourly snapshot-and-restore flows, which required additional attention.
To address these issues, monitoring signals were built, including a heartbeat document on the primary cluster updated hourly, a doc-count difference between index families, and error scraping from Curator logs. These metrics helped monitor replication lag, with the heartbeat surviving architecture changes. However, the recovery point remained the sum of all schedules and transfers, not just the snapshot interval.
A restore-based DR cluster was cold and not suitable for reads, requiring rehearsing the switch and testing the restore process. Lastly, snapshots remained essential as the only method for undoing bad deletes or corrupt writes.
Rewritten by urgent.news; may contain errors — check the original. How we use AI.
Source: dev.to