MySQL Read Replica of RDS on Local Kubernetes Cluster


#1

I have a use case where I want to create a MySQL Read Replica running locally on Kubernetes. This is a Read Replica of the actual MySQL RDS running in AWS.

Now there are ways to achieve this, for that you do following in given sequence:

  • Create a Read Replica on the RDS.
  • Do mysqldump from this remote Read Replica to locally running Read Replica.
  • Now command locally running Read Replica that the master to follow is in actual MySQL master.
  • Delete the Read Replica on RDS.

This is very manual procedure, but I want to automate this so that I can spawn as many local Read Replica as possible and then they replicate data from remote MySQL RDS. I have tried above and it is cumbersome and could be error prone.

Another approach is to use mysql-operator(which I have not tried yet). But from the looks of it and after reading documentation what I have understood is that you can start the local MySQL cluster from a given database snapshot. This will automate the process of getting started for you. But not sure if this will synchronize local Read Replica and remote MySQL RDS. Or how to achieve this with mysql-operator I am not very sure about it.

If anyone has achieved similar approach let me know.