Elie Asmar
Elie Asmar

Reputation: 3165

MongoDB replica set with primary only

After version 4.0, MongoDB has introduced the multi-document transactions for replica sets. In order to use the new feature, I have converted the testing instance to a replica set, following the official documentation.

The end result was a replica set with a primary node, no secondary nodes and no arbiters. I would like to know if this architecture has any implications on performance, data integrity, etc... Any help or reference to a similar case is much appreciated

Upvotes: 1

Views: 824

Answers (1)

Stennie
Stennie

Reputation: 65433

It is valid to have a single member replica set for the purposes of testing or development. This will allow you to use features which require a replica set deployment (for example, transactions in MongoDB 4.0+ and change streams in MongoDB 3.6+).

The main downsides of a single member deployment are that you don't get any of the usual replica set benefits such as data redundancy and fault tolerance, and cannot test more interesting read concerns and write concerns that might be useful in a production deployment. A replica set member has some expected write overhead as compared to a standalone server because it also has to maintain a replication oplog.

A production replica set deployment should have a minimum of three members. See Deploy a replica set in the MongoDB documentation for full details.

Upvotes: 2

Related Questions