OPTIONS

Replica Sets with Four or More Members

On this page

Overview

Although the standard replica set configuration has three members, you can deploy larger sets. Add additional members to a set to increase redundancy or to add capacity for distributing secondary read operations.

Considerations

As you add new members to a replica set, consider the following:

Odd Number of Voting Members

Ensure that the replica set has an odd number of voting members. If you have an even number of voting members, deploy an arbiter so that the set has an odd number.

For example, the following replica set includes an arbiter to ensure an odd number of voting members.

Diagram of a four member replica set plus an arbiter for odd number of votes.

Maximum Number of Voting Members

A replica set can have up to 50 members, but only 7 voting members. [1] If the replica set already has 7 voting members, additional members must be non-voting members.

For example, the following 9 member replica set has 7 voting members and 2 non-voting members.

Diagram of a 9 member replica set with the maximum of 7 voting members.

See Non-Voting Members for more information.

Location of the Members

A majority of the replica set’s members should be in your application’s main data center.

For example, the following 5 member replica set has the majority, 3, of its members in its main data center, Data Center 1.

Diagram of a 5 member replica set distributed across three data centers. Replica set includes a priority 0 member.

Electability of Members

Some members of the replica set, such as members that have networking restraint or limited resources, should not be able to become primary in a failover. Configure members that should not become primary to have priority 0.

For example, the secondary member in the third data center with a priority of 0 cannot become primary:

Diagram of a 5 member replica set distributed across three data centers. Replica set includes a priority 0 member.
[1]While replica sets are the recommended solution for production, a replica set can support up to 50 members in total. If your deployment requires more than 50 members, you’ll need to use master-slave replication. However, master-slave replication lacks the automatic failover capabilities.

Was this page helpful?

Yes No

Thank you for your feedback!

We're sorry! You can Report a Problem to help us improve this page.