3 ms·
You don't have to set your whole system to read only for the entirety of the backup. There are three ways to avoid it: 1) Use mongodump which queries for every
by mathias_10gen 16y ago
You don't have to set your whole system to read only for the entirety of the backup. There are three ways to avoid it:
1) Use mongodump which queries for every object in the database. It will produce a compacted file, but does not do a point-in-time snapshot.
2) Take a backup from a slave. You can either set it to read-only mode, or just shut it down and copy the files.
3) Run MongoDB on top of LVM. LVM supports almost instant snapshotting because it uses copy on write. Once the snapshot has been made (usually less than a few seconds) you can resume the server for read-write operations.
Note that all three options can be combined. You could make an LVM snapshot of a read slave then use mongodump's --dbpath option to produce compacted backup files.
Please see http://www.mongodb.org/display/DOCS/Backups http://www.mongodb.org/display/DOCS/Backups for more details.
- rbranson 16y agoI second the snapshotting using the disk system. It would be nice to be able to do this without locking the database, but LVM or ZFS snapshots take fractions of a second to create. In the mean time, pending transactions will just wait.