Search code examples
mongodbcouchdbreplicationnosql

When to use master-master replication VS master-slave replication


I am using CouchDB as my noSQL database for a CRM solution. CouchDB uses a master-master replication. Compared to this mongodb uses a master-slave replication.

Being a little newcomer to NoSQL,

I would like to clearly understand what are the benefits of a master-master replication over master-slave replication.


Solution

  • In a master-master architecture, you can distribute the power to the places it's most needed. In a CRM, you may want a single point of authority (the head office), but authoritative content may be created by anyone (sales reps, VP's, tech support agents). Master-master let's you bring the canonical data source as close as possible to every content owner/creator in that scenario.

    In master-slave architectures, everyone must be able to reach the canonical authoritative source or risk (at least) having their content overwritten or not be writable at all.

    Apache CouchDB is particularly well suited to master-master replication and coupled with PouchDB can provide applications that work offline-first--cloud optional. These apps can then synchronize their changes when an Internet connection is again available.