Quick revision
The short answer
Use five voting, data-bearing members spread 2 plus 2 plus 1 across three regions, so no single region holds a majority of three and losing any one region leaves a majority that can elect a primary and keep accepting writes. Priorities keep the primary normally in the region closest to most writers, with the second region as the preferred fallback. The cost is that every w:'majority' write waits for at least one member in another region, adding a cross-region round trip, and we avoid arbiters because they hold no data and can block majority acknowledgement; finally we test failover regularly and make sure drivers use retryable writes and reads.
What to remember
In this answer, we placed five voting, data-bearing members as 2 plus 2 plus 1 across three regions, so losing any region leaves a majority that keeps electing a primary and acknowledging majority writes. Priorities keep the primary near most writers and define the fallback. We accepted the cost that every majority write waits for a cross-region round trip, avoided arbiters because they cannot acknowledge writes, and planned regular failover drills with retryable writes and reads in the drivers.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Use five voting, data-bearing members spread 2 plus 2 plus 1 across three regions, so no single region holds a majority of three and losing any one region leaves a majority that can elect a primary and keep accepting writes. Priorities keep the primary normally in the region closest to most writers, with the second region as the preferred fallback. The cost is that every w:'majority' write waits for at least one member in another region, adding a cross-region round trip, and we avoid arbiters because they hold no data and can block majority acknowledgement; finally we test failover regularly and make sure drivers use retryable writes and reads.
Why this question is asked
Surviving the loss of a whole region is a common requirement for critical services, and it is easy to get subtly wrong. A deployment that looks redundant, say three members in one region and two in another, cannot elect a primary if the first region fails. One that uses an arbiter to save cost can stop acknowledging writes when a single data member is down. Interviewers ask this design question to see whether we can count votes, reason about majorities and latency, and explain what we are paying for. In this answer, we will recap elections and majorities, place the members, set priorities, walk through each failure, look at the latency cost, explain why arbiters are a trap here, and finish with testing and driver settings.
1A Quick Recap of Elections and Majorities
In a MongoDB replica set, a primary can only be elected, and can only stay primary, if it can reach a majority of the voting members. With five voting members, a majority is three. The same majority underpins durable writes: a write with w:'majority' is acknowledged once a majority of voting members have it, and such a write cannot be rolled back after a failover.
So surviving a region outage with writes available has one precise meaning: after any one region disappears, the members left must still be a majority, and they must hold all majority-committed writes. Both conditions are about where the votes and data are.
2Placing the Members: 2 Plus 2 Plus 1
With three regions, A, B and C, we place two members in A, two in B and one in C. All five are data-bearing and voting. No region holds three members, so no single region is a majority, and any two regions together are.
| Failure | Members left | Majority of 3? | Result |
|---|---|---|---|
| Region A down | b1, b2, c1 | yes | b1 or b2 elected, writes continue |
| Region B down | a1, a2, c1 | yes | primary stays in A |
| Region C down | a1, a2, b1, b2 | yes | no change, writes continue |
| A and B down | c1 | no | no primary, read-only from c1 |
| Network split A | B+C | A: 2, B+C: 3 | only B+C | A steps down, B+C elects |
The priorities express preference. Region A is where most writers run, so its members have the highest priority and one of them is normally primary. Region B is the preferred fallback. Region C mainly provides the tie-breaking vote and a third copy of the data; a priority of 1 lets it become primary only if nothing better is available, and some teams set it to 0 so it never does. If the primary moves to B after a failover, a higher-priority member in A will call an election to take it back once it has caught up.
3The Cost: Every Majority Write Crosses a Region
Durability across regions is not free. The primary in A has one other member in A, so the second acknowledgement can be local, but a majority of three needs one more, which must be in B or C. Every w:'majority' write therefore waits for at least one cross-region round trip, to whichever of B or C is fastest.
That extra 20 milliseconds or so is exactly the price of surviving a region outage without losing acknowledged writes, and we should state it plainly to the product team. If some data can tolerate loss, such as analytics events, it can use w:1 on its own collection, but orders and payments must use majority. Reads are cheaper: readPreference nearest or tags can serve reads from local members in each region, with the usual replication lag caveat.
4Why Arbiters Are a Trap Here
An arbiter is a member that votes but holds no data. It looks like a cheap way to fill region C. The problem is that w:'majority' counts data-bearing voting members that have the write, and an arbiter can never have it. Consider a primary, a secondary and an arbiter. If the secondary is down, the primary can still be elected with the arbiter's vote, but majority writes cannot be acknowledged, because only one data-bearing member has them. Writes time out, and the majority commit point stops advancing, which builds cache pressure on the primary.
In our five-member layout, replacing c1 with an arbiter would mean that after losing region A, only b1 and b2 hold data, and majority writes would need both of them every time; losing either member would stop majority acknowledgement. A small data-bearing member in region C costs more than an arbiter but keeps majority writes working in the failure we designed for.
5Testing Failover and Driver Settings
A failover design that is never exercised will fail in some unexpected way on the day it is needed. So we test regularly in staging and, carefully, in production: rs.stepDown() on the primary to force an election, and a simulated region outage by blocking network traffic to all members in one region. We measure how long writes are unavailable, typically around 10 to 15 seconds with default election settings, and whether applications recover by themselves.
The applications need the right driver behaviour. Retryable writes, on by default in current drivers, retry a write once after a failover or network error, and retryable reads do the same for reads. Connection strings list members in all regions so the driver can discover the new primary. Timeouts must allow for an election, and write paths should be idempotent so a retry is safe.
- Block traffic to region Aprimary and one secondary unreachable
- Remaining 3 members elect b1majority still present
- Drivers detect the new primaryretryable writes resend in-flight writes
- Are writes back within the target?often 10 to 15 secondsYesRecord time and finishNoInvestigate driver or timeout settings
- Restore region Aa1 catches up and, with higher priority, takes back primary
5 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Why not 1 plus 1 plus 1?
Three members across three regions also survives a region loss, but after one failure there are only two members left, and losing one more stops writes. Two in the main regions also gives a local acknowledgement and a local failover candidate, so 2 plus 2 plus 1 is the more robust choice.
What about users far from region A?
Their writes travel to the primary in A. If writers are spread globally, we consider sharding with zones so each region's data has its primary nearby, which is a bigger design but avoids cross-continent write latency for everyone.
Can we put the member in region C on smaller hardware?
It must be able to keep up with replication and, if its priority is above 0, to serve as primary briefly. Many teams set it to priority 0 and size it to replicate reliably, accepting that it only votes and holds a copy.
7Conclusion
In this answer, we placed five voting, data-bearing members as 2 plus 2 plus 1 across three regions, so losing any region leaves a majority that keeps electing a primary and acknowledging majority writes. Priorities keep the primary near most writers and define the fallback. We accepted the cost that every majority write waits for a cross-region round trip, avoided arbiters because they cannot acknowledge writes, and planned regular failover drills with retryable writes and reads in the drivers.
Open with
I would run five voting, data-bearing members split two, two and one across three regions. A majority is three, and no region has three members, so if any one region goes down, the other two still have at least three votes, elect a primary and keep accepting majority writes.
Then, if they want more
Priorities put the primary normally in the region closest to most writers, say both members in region A at priority 3, region B at 2 as the fallback, and region C at 1 or 0, because C is mainly the tie-breaker and a third copy.
The trade-off I would state clearly is latency: a majority write needs the primary, the other local member and one member in another region, so every write pays a cross-region round trip, maybe twenty milliseconds. That is the price of not losing acknowledged writes when a region disappears.
I would not use an arbiter in region C, because arbiters hold no data, and majority acknowledgement needs data-bearing members; with an arbiter, losing one data member can block majority writes.
Finally I would test failover regularly, using stepDown and simulated region outages, measure how long writes are unavailable, and make sure drivers use retryable writes and reads, list members in all regions, and that writes are idempotent.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- MongoDB manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Design a MongoDB replica set deployment across three regions for a service that needs to...": https://scrivio-interview-library.netlify.app/databases/mongodb/8eb8669f70/