I need to create a system with multiple databases one of this are the master database this database need to replicate only structural changes to another databases for example:
When i register a new user in the system, the system create automatically an structural replica of the master database but this database not send the inserted registers or updates to the master database only the master database when is updated send all structural changes to the slave databases, therefore i need to create a script or implement tool to capture the database updates to execute the updates on all slaves in realtime.
I sent a question to aws support and they recommend me to implement a phyton script or integrate another library who allow do a binlog streaming to replicate these changes to the slaves databases.
aws support answer:
You can follow this guide here[1], you can skip the Kinesis (AWS Service) part and have you code write directly instead on putting it in the kinesis stream . You will need to enable binlog on your DB cluster and listen to the log. Depending on the events you can add in logic to perform DB updates on child databases. In order to replicate the your master database schema I would recommend using the mysqldump cli tool to export the schema of your master database before any child databases need to provision and import that schema. Then use the binlog script to push changes to your child databases depending on your logic you have written.
[1] https://aws.amazon.com/blogs/database/streaming-changes-in-a-database-with-amazon-kinesis/
via Brayan Caldera
No comments:
Post a Comment