Database Reference
In-Depth Information
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/replica-
tion/ .
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 opera-
tions. So, in this situation, operations are limited and you cannot perform write operations
until the primary node is available.
There are several ways to address these kinds of issues, such as providing an internal loop
statement and trying to insert data until the primary node becomes available. On the other
hand, using a queue system and putting all the write operations in it and then applying them
when the primary node becomes available is another solution.
In further chapters, we will talk about the high availability of replica sets in detail.
Search WWH ::




Custom Search