MongoDB Replica Set Configuration series seven: MongoDB Oplog detailed

Source: Internet
Author: User

1:oplog Introduction

Oplog is a fixed collection under the local library, and secondary is copied by looking at the primary Oplog collection. Each node has a oplog that records the information that is copied from the primary node so that each member can be used as a synchronization source to other nodes.

2: The process of replica set data synchronization

Detailed procedures for data synchronization in a replica set: The primary node writes the data, secondary copies the information by reading the oplog of the primary, begins copying the data, and writes the copied information to its own oplog. The backup node stops copying data from the current data source if an operation fails (which can occur only if the data for the synchronization source is corrupted or the data is inconsistent with the primary node). If a backup node is suspended for some reason, when restarted, it will automatically start synchronization from the last action of Oplog, after the synchronization is completed, the information will be written to its own oplog, since the copy operation is to replicate the data before the copy is completed and then write Oplog, it is possible that the same operation will synchronize two copies, However, MongoDB at the beginning of the design to consider this problem, will oplog the same operation executed multiple times, and the effect is the same as the execution once.

The growth rate of 3:oplog

Oplog is a fixed size, he can only save a specific number of operation logs, usually oplog use of space growth rate with the system to process write requests, if the primary node processing 1KB of write data per minute, then oplog every minute about also write 1KB data. If a single operation affects multiple documents (such as deleting multiple documents or updating multiple documents), Oplog may have more than one action log. Db.testcoll.remove () deleted 1 million documents, there will be 1 million operation logs in the Oplog. If there is a large volume of operations, Oplog may soon be full.

MongoDB Replica Set Configuration series seven: MongoDB Oplog detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.