In normal MySQL replication setup that when a primary is having an issue, chances are, the slave are lag behind and didn't have the latest data.
In AWS RDS when a slave is being automatically promoted to master, questions:
The first fact to point out is that MySQL RDS Read Replicas use asynchronous replication, so your master instance will be replicating these after the transacted SQL has been executed. If this RDS instance fails, then yes there might be a chance that you lose a small amount of data.
It then uses the engines' native asynchronous replication to update the read replica whenever there is a change to the source DB instance
The steps that should be followed during a promotion of a read replica should go as follows:
If you promote the RDS instance it becomes a standalone RDS instance at that point, it will only contain the transactions that it had up until the promotion. Any other red replicas will remain with the original cluster.
Even if the primary DB comes back, at that point your promoted RDS instance is part of a different cluster, at this point it is not possible to reverse the action. If there was any transactions difference between they will need to manually be applied.
For your application the major change is that the Database DNS name has now changed. I would advise creating or using a private route 53 hosted zone and create a CNAME record pointing to the original RDS cname. Once you have done this update your application to use the CNAME in your private hosted zone.
If you ever needed to promote the read replica you would then just need to update the CNAME value in your Route 53 to the new RDS CNAME. If you do use this, remember to keep the TTL low for your Route 53 record to ensure that failover is quick.
Alternatively, if you can use a Multi-AZ setup it will perform the promotions and failover automatically for you.
To summarise this to the answers to your 3 questions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With