Setup MongoDB Replica Set in 4 steps

Introduction

Before going into details of configuring MongoDB replica sets, let me give brief details about same:

  • Replica Set is the feature provided by the Mongodb database to achieve high availability and automatic failover.
  • It is kinda traditional master-slave configuration but have capability of automatic failover.
  • It is basically group/cluster of the mongod instances which communicates, replicates to each other to provide high availability and to do automatic failover
  • Basically, in replica sets there are minimum 2 and maximum of 12 mongod instances can exist
  • In replica set following types of server exist. out of all, one server is always primary.
    • Primary: It stores the data, all write/read operation goes to this server from any client.
    • Secondary: First it stores the data, second these servers stays in sync with primary, if   primary server goes down then these servers are for failover to the primary.

Source : http://www.javacodegeeks.com/2013/07/setup-mongodb-replica-set-in-4-steps.html

Back to Top