官术网_书友最值得收藏!

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 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.

主站蜘蛛池模板: 固阳县| 郑州市| 都江堰市| 永清县| 平利县| 柘荣县| 云林县| 庆安县| 郸城县| 肃宁县| 开平市| 边坝县| 综艺| 池州市| 凤凰县| 伊吾县| 吉林市| 滕州市| 荥阳市| 芦溪县| 哈尔滨市| 曲沃县| 含山县| 古交市| 台中县| 张掖市| 毕节市| 东乌珠穆沁旗| 普宁市| 北安市| 乌拉特前旗| 张北县| 龙山县| 隆化县| 南郑县| 平度市| 米脂县| 农安县| 峨眉山市| 东山县| 永胜县|