If a replica set member fails to respond to the regularly scheduled heartbeat within a predefined interval, the other members of the replica set assume it has failed and hold an election (https://docs.mongodb.com/manual/core/replica-set-elections/#replica-set-elections). A new primary is elected, which immediately starts accepting read and write requests and replicating its database. The following diagram illustrates the situation before and after an election:
Each member server has one vote. On the left side of the preceding diagram, the primary has gone offline. The remaining secondaries in the replica set hold an election. After the election, as shown on the right side of the diagram, the topmost secondary is elected as the new primary.
In order to avoid a voting deadlock (for example, where an even number of remaining servers are split over who becomes the new primary), it is possible to establish arbiters. An arbiter is a server that is part of...