General backup strategy for MongoDB

Source: Internet
Author: User
Tags readable mongodump mongorestore

General backup strategy for MongoDB
1 Cold Backup--Copy database files
2 Mongodump/mongorestore
Besides Mongodump/mongorestore, there's a couple of mongoexport/mongoimport.
Difference:
Mongoexport/mongoimport Import/Export is in JSON format, and Mongodump/mongorestore Import/export is Bson format.
JSON is readable but bulky, and Bson is a binary file, small in size but hardly readable for humans.
Bson format is Mongodump/mongorestore cross-version may fail, JSON format is mongoexport/mongoimport can operate across versions
The JSON format retains only part of the data, and does not retain other basic information such as indexes, accounts, and so on.

Mongodump Backup Options--oplog
Note that this is dedicated to replica set or Master/slave mode, and the--oplog option is only valid for full-library export, so you cannot specify the-D option. Because the entire instance of the change operation will be concentrated in the local library in the Oplog.rs collection.
The actual effect is to generate a Oplog.bson file at the same time as the export, storing all the oplog between the dump and dump end you start
In replica set, Oplog is a set of capped collection, the default size of which is 5% of the disk space (which can be modified by the--OPLOGSIZEMB parameter), which is located in the db.oplog.rs of the local library.
It records all changes (insert/update/DELETE) operations of the database over time for the entire Mongod instance. Automatically overwrites oldest records when space runs out of time
Its coverage is called the Oplog time window. It is important to note that because Oplog is a set of constant capacity, the range of time windows can cover varies depending on the number of updates in your unit time.

Simply put, the backup will produce two files: database files and Oplog.bson files, the database file holds the data of the backup beginning to a certain time in the end time period,
The Oplog.bson file stores the time the dump started and the system changes the record to Oplog.bson

Recover data files before recovering data in Oplog.bson

General backup strategy for MongoDB

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.