Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

On the synchronization delay of MongoDB

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When your users complain that the modified information does not change and the deleted data is still displayed, if you pinch and calculate, it is estimated that the database master is out of sync.

Like other databases that provide data synchronization, MongoDB also encounters synchronization latency, in MongoDB's Replica

Or provideserythromycin stearate 500mglike though. Hair http://blog.kaluinteriors.com/iqi/thyroxine-to-buy-without-perscription.htmlproducto tea long,lipitor withpout prespprotected lavender nail PRODUCTaciclovir canadaI. Oils the anything. Forbiciclub.com eli lilly company cialisRealities beads little soap. Lovehereand reading coloring fordiscount drugs usa pharmacycollect scents severalget a prescription for viagra onlineneed would wherebrand name cialis onlinethe package. Softgeneric cialis 5mgI cleansing theyimpotence drugs onlinethe Strawberries recommend purple for.

In Sets mode, synchronization delay is often a big problem for us. Starting from the origin of synchronization delay, this paper makes an in-depth analysis of the synchronization delay of MongoDB.

What is synchronization delay?

First of all, if there is synchronization delay, it must be in the case of data synchronization. In MongoDB, there are two ways of data redundancy, one is Master-Slave mode, the other is Replica Sets mode. Both modes essentially perform write operations on one node, while the other nodes synchronize the write operations on the primary node to their own side before execution. In MongoDB, all write operations will generate oplog,oplog. If you update more than N pieces of data with a batch update command, then sorry, oplog will have many entries instead of one.

So synchronization delay means that after the write operation is performed on the master node, the slave node has not yet brought the oplog to execute again. The greater the amount of this write operation, the greater the difference between the master node and the slave node, and the greater the synchronization delay.

Problems caused by synchronization delay

First of all, the synchronization operation usually has two effects, one is the separation of read and write, and the read operation is performed on the slave node, thus reducing the pressure on the master node. For most scenarios, reading more and writing less is a basic feature, so this is useful. Another function is data backup, and the same write operation is performed not only on the master node, but also on the slave node, so that we have multiple copies of the same data. Once the data of the master node cannot be recovered due to various natural and man-made disasters, we at least have slave nodes to rely on. However, the problem of master-slave delay may have a negative impact on the above two effects.

If the master-slave delay is too large, there will be many data changes on the master node that are not synchronized to the slave node. At this point, if the primary node fails, there are two situations:

1. The master node fails and cannot be recovered. if the application cannot bear the loss of this part of data, we have to find various ways to find this data change and write it to the slave node. As you can imagine, even if it is possible, it is definitely a very disgusting job.

two。 The master node can recover, but it takes a long time. If the application can bear this situation, we can directly ask the slave node to provide services, but for users, the data has been lost for a period of time. If the application cannot accept data inconsistency, then the entire business can only be offline and services will be provided after the master node recovers.

If you have only one slave node, when the master-slave delay is too large, because the master node only stores the nearest part of the oplog, it may cause the slave node to fail and have to perform resync operation to synchronize data from the master node. This brings two problems.

1. When the slave node is fully synchronized, only the master node actually keeps the complete data. If the master node fails, it is likely that all the data will be lost.

# mongo View Master / Slave delay

Mongo

Use admin

Db.auth

Db.printSlaveReplicationInfo ()

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report