MongoDB Replica Set automatic deployment

MongoDB supports master-slave replication and a variation on master-slave replication known as replica sets. Replica sets are the recommended replication topology. What is the difference?

Replication vs. Replica Set

MongoDB’s replication is “single-master”, meaning only one node can accept write operations at a time.

In a replica set, on the other hand, if the current “primary” node fails or becomes inaccessible, the other members can autonomously elect one of the other members of the set to be the new “primary”.

replica-set-primary-with-two-secondaries

The minimum architecture of a replica set has three members. A three member replica set can have either three members that hold data, or two members that hold data and an arbiter.

Replica sets provide redundancy and high availability, and are the basis for all production deployments. Replication provides redundancy and increases data availability. With multiple copies of data on different database servers, replication protects a database from the loss of a single server.

To ease the process of creating a MongoDB replica set, we’ve prepared for you a Marketplace installation that, by default, creates for you a replica set with three MongoDB 3 database members and RockMongo web admin interface. You can install replica set on your Jelastic account following these simple steps:

Installation

1. Log in to your Jelastic dashboard via https://app.j.layershift.co.uk/.

2. Click on the Marketplace icon near the top-left corner and search MongoDB:

mongo01

3. Choose to install MongoDB Replica Set application, specify environment and replica set name:

mongo02

4. Sit back and relax while your MongoDB replica set is being deployed.

mongo03

5. After the installation completes, you will see a confirmation message and receive emails with passwords for your replica set members as well as short information about configuration options:

mongo04

In your browser, open RockMongo admin panel and check replication status on the Master/Slave tab:

mongo05

Configuration Options

The MongoDB 3 replica set Jelastic Marketplace installation provides a YAML-based configuration file format, that was introduced with MongoDB 2.6. The configuration format differs a little from the MongoDB 2.4 configuration file format, however, we’ve described all the options in the file for you. If you need help with configuration options, please refer to MongoDB official documentation or ask our support team for assistance.

Read more on MongoDB replica set in the official documentation.