Is it possible to setup CouchDB like replication for MySQL?
- Replication to be initiated from an web application.
- Replication should be a two way process. i.e. Synchronization
- If there is a failure in network connection, replication should take over where it left.
- Schronization should be incremental.
- The kind of data stored is Invoice.
- Syncronization should be atomic. Either it should copy the whole invoice OR nothing.
Should I go for an custom synchronization logic here? I am planning to use Hibernate for data storage.
You can configure MySQL in Master-Master mode in an active-passive configuration. One server will serve as the master while the other one stays in sync as a slave of the master (plain MySQL Replication is asynchronous in nature, btw). The secondary acts as the master of the primary, but since it's not being written to, nothing actually gets written back to the master in this case. If the primary fails, you can start using the secondary one as the main master (ie: point your app to it). Eventually when you fix the master, assuming all the data and configuration was intact, you can re-establish replication and it can pick up where it left off.
Check out the Multi-Master Replication Manager project that can help you achieve this:
http://mysql-mmm.org/
Good luck!