I have an scenario,
I have two DB server running on two different machines.
I have to build an automated process by which the data will replicate from one DB to another DB server on every insertion happens in first one.
My application using spring- hibernate and mysql DB.
I can go for DB side or spring-hibernate side approach.
Is it possible to do this with rabbitMQ?
I have an option to call automated process on each insertion or as a batch process or using queue.Some of the answers mention in the following link, but it is not clear to me
Any help would be greatly appreciated
I have an scenario,
Do not try to make it harder than it actually is. Replication mechanism build-in mySQL will be the best for that. There is a ton of tutorials in google, ex.:
Basically, You need master-slave configuration.
Here are my thoughts on this,
1. Via DB Side,
If you don't want to mesh the deployment aspects with your application then this is best one. The system admin people will take care of these burden from you. They will setup the master-slave setup and your application will seamlessly access the db.
2. Spring - Hibernate
In this way you can use interceptors and send all your queries to the replication machine as well. But this is will decrease your application's performance as well so you have to thing a lot on this before getting into this and also it if anything goes wrong during replication then your application transaction as well will get affected. So need more caution on this while designing.
3. Separate External job with Hibernate interceptors combination:
You can design some external worker manager kind of async tasks and dispatch your replication job over to these workers. some kind of batch also you have to maintain for better performane, maintainability and control. So you can maintain the modified entities into separate queue (It may be redis / rappitMQ ) from there your external job will take care the replication process. So your application is released from the burden.