Unlock the power of delayed replication in Amazon RDS for MySQL! This blog post dives deep into enabling and leveraging this feature for data recovery, backups, and ETL/analytics workflows.
Delayed replication is one of the important features which were being supported in MySQL from 5.6 for a very long time. This induces an intentional lag in the slave, making it lag by the defined time interval.
For a long time this was not available with the RDS version of MySQL provided by AWS, Recently from the version 5.6.40, 5.722 and later versions this feature is available with all the regions.
I will give a small intro on Amazon RDS, Which is DBAAS provided by Amazon, where you will be given an end-point for all your DB operations and major of admin task of server and DB is taken care by Amazon, To know more you can view our presentation here
I will demonstrate, how to have a delayed slave with Amazon RDS for MySQL
Note: If you are running with older versions of MySQL, please patch-up to 5.6.40 and 5.7.22. It’s pretty simple and straightforward.
Below is the environment for this demo.
Instance Type: M4.large (8GB & 2 VCPU)
MySQL Version : 5.6.40 Source distribution
Am inducing intentional lag in an existing slave, which is already in sync with the master.
Stopping the replication
Add delay-interval in secs:
Once After adding the delay, you can see a stall in the SQL thread and lag starting to build up in the slave status.
Once the slave is delayed with the required time interval of 1 hour, you can find the status as below.
You can also check the status as below.
Benefits:
Below are some of the benefits of having a delayed slave.
- Recovery of data during a human error, Such as accidental delete or drop of a table
- As a backup server
- For ETL/ Analytics with acceptable delay.
Thanks for your time and attention. Next waiting for the filtered replication to be implemented with RDS, for solving many of the use-cases.
Empower your MySQL administration with Mydbops' open-source database management tools. Streamline tasks, optimize performance, and manage replication with ease.
{{cta}}