16

Documentation here says three: http://docs.mongodb.org/manual/tutorial/deploy-replica-set/

"A replica set requires three distinct systems..."

Whereas the documentation here says two: http://docs.mongodb.org/manual/core/replication/

"Most replica sets consists of two or more mongod instances..."

Anyone know which is correct?

2 Answers 2

19

You can actually run a single member "set" if you want.

3 members (or a higher odd number) is really best, though. Replica sets go read only if a majority of the set isn't available, so if you lose a member in a two-member set the remaining member becomes read only.

You can run two full members plus an "voting-only" member (called an arbiter) as well. This is the smallest reasonably safe option for a replica set.

1
  • 6
    Want to highlight that two members is not a fault tolerant system. @MrKurt is correct that if one member goes down (unplanned) then the other can not be PRIMARY and will step down to SECONDARY (read only). In other words, if you need a replica in production, 3 members is the minimum for fault tolerance against a member failing. Dec 23, 2014 at 17:17
3

This is basically a wording issue because the requirements in the tutorial are not a general statement about replica sets, rather they pertain to the tutorial itelf. The requirement for deploying a replica set in general is 1 or more, most have 2 or more, but the tutorial you link to is specifically to deploy a 3 member set:

This tutorial describes how to create a three member replica set from three existing instances of MongoDB

Hence, the requirement for the tutorial is that the set have 3 members. Nevertheless, it is a little confusing to have the two statements, so I submitted a pull request (EDIT: pull request has now been merged in) to clean it up a bit.

You can have a single mongod node configured to be part of a replica set, but strictly speaking that would not be a "set". In fact, since replication uses more resources than a standalone mongod (basically because of the oplog) there is really no point to running a single member unless it is as a temporary measure before you add other members to the set or if you require an oplog for other reasons (such as backup).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .