architecture/design/disaster-recovery.md
This document describes supported options for cross-region disaster recovery when using YugabyteDB.
Deploying a single cluster across three or more regions provides out-of-the-box disaster recovery in case one of the regions becomes unavailable. The advantages of this approach are:
The major tradeoff, however, is that update latencies are increased due to replication across regions. The second option, which is described below, allows you to minimize the latencies by paying the price of non-zero RPO.
This option is based on the following requirements:
The solution is to deploy two independent clusters in different regions with uni-directional asynchronous data replication (implemented by xCluster feature).
The initial configuration required for the solution is the following:
With such configuration, cluster B is on stand-by, so applications can switch to it at any time with minimal RTO. Async nature of replication guarantees that update latencies are not affected by the presence of the stand-by cluster.
There are two distinct cases for failover:
Assuming cluster A is the source and cluster B is the target, the following steps are required to perform planned failover process:
As a result, cluster B becomes the source that replicates updates to cluster A. There is no data loss, so the RPO is zero.
Assuming cluster A is the source, cluster B is the target, and cluster A becomes unavailable, the following steps are required to perform failover process:
When cluster A comes back up, it needs to be restarted as a new target cluster and restored to a consistent state. Support for this will be provided in two phases.
In phase 1, the process will be the following:
Phase 2 will lift the requirement of repopulating the databases by addressing the clock skew concerns. The process will be the following:
At this point, B is the source cluster and A is the target cluster. To switch back to the initial configuration, the planned failover flow can be used.
The following APIs are required to support failover flows described above.
Pauses replication by preventing the target cluster from pulling data from the source cluster.
Invoked on either source or target cluster.
Resumes replication by allowing the target cluster to pull data from the source cluster.
Invoked on either source or target cluster.
Waits for all pending updates to be replicated from the source cluster to the target cluster.
Invoked on the target cluster.
Gets the latest consistent time for the target cluster.
Invoked on the target cluster.
TBD
The work is tracked here: #13532