Failover in replica set
In MongoDB, we have a feature that enables clustering for a database. This feature is called a replica set. In further chapters, we will introduce and review it in detail. However, for this chapter, a brief introduction to this feature is enough.
Note
A replica set in MongoDB is a group of mongod
processes that maintain the same dataset. Replica sets provide redundancy and high availability and are the basis for all production deployments. For more information, please visit http://docs.mongodb.org/manual/replication/.
In replica sets, when the primary node becomes unavailable, the replica set conducts an election process to choose a new primary member from secondaries. This change might take about 10 to 60 seconds. However, it varies between servers and depends on the replica set settings, numbers of nodes, and server capacity.
While performing the election process, the replica set becomes unavailable for write operations. So, in this situation, operations are limited...