MongoDB Backup method

Source: Internet
Author: User
Tags mongodump mongorestore

Translated from http://docs.mongodb.org/manual/core/backups/

There are several ways to back up the MongoDB cluster:

    • Backup by copying the underlying data file
    • Back up with Mongodump
    • Cloud Backup via MMS (Mms:mongodb Management Service)
    • Backup software via MMS on Prem backup

1. Backup by copying the underlying data file

If the storage device supports a point-in-time snapshot (snapshot), you can use these snapshots to create a backup of MongoDB. Amazon's EBS storage system, for example, supports EC2 snapshots. LVM Manager is able to generate snapshots on Linux.

If MongoDB is running, to get a proper snapshot, MongoDB must turn on the log function, and the log file and MongoDB data file will be on the same logical volume (logical volume). If the log (journaling) feature is not turned on, the data in the resulting snapshot cannot be guaranteed to be consistent.

For sharding Systems (sharded system), you must turn off balancer and obtain snapshot for each shard and each config server at the same time.

You can also use CP, rsync or other tools to copy files. However, copying multiple files is not an atomic operation, you must stop all writes before copying, otherwise the copied data may be in an inconsistent state.

2. Mongodump

By copying the underlying file does not support point-in-time recovery (point-in-time recovery) of the complex set (replica set), and it is difficult to manage large shard clusters. In addition, these copies are large because they contain indexes and the underlying padding and fragments. and mongodump can generate smaller backups.

The Mongodump tool reads data from the MONGODB database and generates a Bson file. Mongorestore is able to restore this data to the MongoDB database. Mongodump is a very effective tool for small databases and is not ideal for large database systems.

Mongodump and Mongorestore can operate while the Mongod process is running, and can manipulate the underlying data files.

Mongodump does not back up the index file, so you need to rebuild index after recovering the database.

Use Mongodump and Mongorestore for detailed instructions http://docs.mongodb.org/manual/tutorial/backup-with-mongodump/

MongoDB Backup method

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.