Talking about the backup way of MongoDB _mongodb

Source: Internet
Author: User
Tags mongodb

Briefly describe how MongoDB is backed up:

1. Mogodump/mongorestore

These 2 commands mongodb the data into the Bson format and can be recovered when needed.
This approach is also applicable as a small database. But if it's sharding or more than hundreds of G data,
is almost impossible to use. Because of the Bson and the space it occupies.

2. Slave Replication

This is the most suitable and reliable, suitable for the production environment. MongoDB supports master+ multiple slave. So it's convenient to start a slave for backup.
However, it is important to note that if the amount of data is very large, if the new slave, speed and no guarantee, we must adjust the size of the oplogsize, for a 300G database,
Can be tuned to more than 60G. In this way, avoid synchronization to the middle of the occurrence of oplogsize and other exceptions.

3. About incremental Hot backup

For some comrades who are passionate about separate file backups, consider using the "incremental hot" backup as a final barrier.
The practice is to initially temporarily shutdown a slave, and then copy the database files to another directory as the starting point for incremental backups.

Each time the backup, in this directory up a slave, using the –fastsync parameters, synchronization is complete can be tar this directory on it.

A disadvantage of this approach is that if the backup cycle is too long, the space waste will be very large, especially in the case of frequent deletion,
The previous version of 1.6 is currently a bug for the deleted space recycle mechanism. This issue should be resolved at the time of release 1.6.

To reclaim these spaces needs to be repairdatabase, slower, and to clone a new db directly from scratch. (In fact, the process of repair is first clone and then copy back).

To sum up, the most reliable and secure way to backup is to use MongoDB's own synchronous replication mechanism.
The most classic and smallest production environment is:
1 Master + 2 Slaves

The above mentioned is this article about MongoDB Backup way of full content, hope everybody can like.

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.