You are the DBA for a MongoDB 6.0 replica set with three voting members: rs0-primary (priority 2), rs0-secondary-1 (priority 1), and rs0-secondary-2 (priority 1). The primary fails and is unavailable for an extended period. You need to ensure that rs0-secondary-1 is elected as the new primary instead of rs0-secondary-2. Which action should you take before the primary fails?
Raising rs0-secondary-1's priority above rs0-secondary-2's priority ensures that, when the current primary is unavailable, rs0-secondary-1 is more likely to win the election. Lowering rs0-secondary-2's priority to 0.5 further reduces its chance of being elected, while still allowing it to vote. This is the correct way to influence election outcomes without making the member unelectable.
Why this answer
Election priority determines which eligible secondary is most likely to win an election. By setting rs0-secondary-1's priority higher than rs0-secondary-2's, you make it the preferred candidate. Lowering rs0-secondary-2's priority to a non-zero value keeps it as a voting member but reduces its election chances.
This approach is the standard way to control primary election outcomes in a MongoDB replica set without making a member unelectable.
Exam trap
The trap here is confusing votes with priority; votes control whether a member can vote in elections, while priority controls which member is more likely to be elected primary.