Saturday 21 February 2015

mongoDB : Replica set


Replica set in mongoDB is a group of mongod processes that maintain the same data set. Replica sets are used to provide redundancy.  At any instance of time, there is one primary node in replica set and remaining nodes acts as secondary nodes. All writes are go to primary node.

Replica set elections
Replica sets use elections to determine primary node. Let’s say there are nodes N1, N2, N3 and N1 is the primary node in the replica set. If node N1 goes down, then election occurs between N2 and N3. Finally one node will be chosen as a primary node, other acts as secondary.

All write operations go to primary node, so when the primary goes down. Replica set initiate for an election. However, elections take time to complete. While an election is in process, the replica set has no primary and cannot accept writes and all remaining members become read-only.


Prevoius                                                 Next                                                 Home

No comments:

Post a Comment