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:
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.
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.
Thank you for your response and the provided documentation link.
However, based on the recommendations in the official documentation, I noticed that the suggested replica set configurations across two data centers might encounter situations where write operations are not possible. My goal is to ensure read/write availability at all times, even if one data center fails.
Specifically, I want the secondary data center to be able to elect a primary node and maintain read/write availability in the event of a failure in the primary data center. Additionally, once the primary data center is restored, I want the primary node to migrate back to the primary data center.
My proposed configuration 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 effectively achieve my goals? Or are there any other recommended configurations to achieve this? I look forward to your further guidance.