MongoDB Replica Set Deployment Across Two Data Centers

Hello,
I am currently exploring optimal deployment strategies for a MongoDB Replica Set across two data centers. My goal is to ensure high availability and seamless failover, specifically achieving the following:

  1. In the event of a failure in the primary data center, the secondary data center should be able to elect a primary node and maintain read/write availability.
  2. Once the primary data center is restored, we want the primary node to migrate back to the primary data center.
    My proposed deployment strategy is as follows:
  • Deploy two nodes, including the primary node with the highest priority, in the primary data center.
  • Deploy three secondary nodes in the secondary data center.
    Would this configuration be effective in achieving our goals? Are there any potential issues or best practices we should be aware of?
    Thank you in advance for your insights and recommendations.

Hi @464519755 and welcome to the community forum.

I would recommend you going through the documentation on Replica Sets Distributed Across Two or More Data Centers to understand the best practices needed to deploy.

Let us know if you have further questions.

Regards
Aasawari