In current times, there is a high degree of focus on ensuring the availability and recovery of your production data. This can be challenging at times when using DBaaS solutions in the public cloud space, for example, when using AWS Aurora. Relying solely on a single cloud provider for database services can pose significant risks. Recent incidents, such as the outage experienced by UniSuper on Google Cloud, highlight the potential pitfalls of depending exclusively on one cloud platform for critical data services.
I have encountered multiple discussions surrounding the need for an external replica of a public cloud database instance. In this blog post, we’ll explain why an external replica can be a beneficial addition to your environment and improve your data recovery strategy beyond the provided point-in-time recovery options.
We will use AWS Aurora as an example, though the principles/scenarios discussed apply to other cloud database providers as well. We’re discussing the advantages of having an external replica for an AWS Aurora environment. Firstly, let’s review the high-level options provided with native backups and recovery for Aurora.
Using the available “LatestRestorableTime” from “EarliestRestorableTime,” you can specify a specific time for the restoration.
All of the above points from the Aurora recovery scenario hint that everything is mapped against time. One cannot restore to a specific transaction when multiple transactions are ongoing simultaneously. Consider that certain businesses may require highly granular recovery options. These in-cloud solutions, although robust, might not address all recovery needs or offer the flexibility necessary for certain critical applications.
Let’s introduce an external delayed replica on our Aurora cluster and set up the following backup configuration on the replica server.
A daily full physical backup will allow a quick restore from the backup. Mydumper is a logical backup solution that takes consistent backup per table file and can also be used for the restoration of a single table. Binary logs can be used for point-in-time recovery for a specific transaction.
In a hypothetical situation where you want to restore a single table, either due to a bad DML statement or an accidental drop, the recovery options are as follows:
Pro-Tip: Use mydumper / myloader for parallel logical backup and restore instead of single threaded mysqldump.
Thus, with the delayed external replica recovery, it is possible without having to do a full restore with PITR, but instead stop replication or advance it to the point of failure and then backup/restore. Also, the second advantage here is a transaction-level PITR. If you need something with higher granularity than restoring to a particular second, then this is really your only option.
Also, in a case where we might need to consider migrating away from Aurora, having an external replica will ease the pain of restoring the full database to a new instance using a logical backup.
| Scenario | Aurora Recovery | External Delayed Replica Recovery |
| Single Table Recovery | Restore a full backup (snapshot), extract the table, and then apply binary logs. This process can be time-consuming. | Stop replication, use mysqldump to back up the desired table, and restore it to the Aurora instance. |
| Granular PITR | Backtracking is limited to time-based recovery, potentially affecting other concurrent transactions. | Provides transaction-level PITR by syncing replication until the disaster point, stopping replication, and restoring. |
| Migration Away from Aurora | May require full restore and logical backup for migration. | Simplifies migration with an external replica, easing the process of restoring to a new instance using logical backups. |
It is important to consider implementing an external (delayed) replica in your architecture. This provides more control and flexibility for your data recovery strategy. Whether for disaster recovery, reporting, or simplifying cloud migrations for multi-cloud strategies, this approach ensures that your data management is both resilient and adaptable to changing requirements.
P.S.:
Lookout Uses Percona’s Cloud Expertise to Reduce Footprint and Maintain Uptime
When a more fully customized solution is required, most of our customers usually prefer the use of AWS EC2 instances supported by our managed services offering.
Resources
RELATED POSTS