I'm working on a project where I need to deploy two MongoDB databases in different geographical locations. I want both databases to work independently, allowing reads and writes on both sides. However, I also need a mechanism to ensure that changes made in one database are synced to the other in a master-master-like fashion.
What strategies or technologies can I employ to achieve this master-master replication setup in MongoDB? Are there any best practices or specific considerations for handling synchronization across different locations? I'd appreciate any insights, examples, or recommended tools to implement a robust and reliable solution for keeping two MongoDB databases in sync.
I've explored Active-passive, but it doesn't entirely fulfill my requirement for a master-master setup with databases deployed in different geographical locations. While primary-secondary replication is excellent for high availability and fault tolerance, it doesn't support simultaneous writes to both databases, making it fall short for my specific use case.
mongosin each geographical location. However, for the data bearing nodes you can have only one PRIMARY and only the PRIMARY permits write operations. Or you can deploy synchronization by yourself on application level.