Database Reference
In-Depth Information
Backing Up a Single Collection
Imagine you have a blog site where the contents of the authors collection do not change much. Instead, the rapidly
changing content of the blog site is contained in the posts and tagcloud collections. You might back up the entire
database only once a day but want to back up these two collections once per hour. Fortunately, you can do that easily
with mongodump by using the -c option to specify the collection you wish to back up.
The mongodump utility does not clear its destination directories. This means that, for each collection you want
to back up, you can call mongodump successively to add a given collection to your backup, as shown in the following
example:
$mkdir ~/backuptemp
$cd ~/backuptemp
$mongodump -d blog -c posts
$mongodump -d blog -c tagcloud
...
archive the dump folder ~/backuptemp away as a tar file
...
$ cd ~
$ rm -rf backuptemp
Digging Deeper into Backups
At this point, you know how to perform the rudimentary tasks of backing up and subsequently restoring your data.
Now you're ready to look at some of the powerful options that allow you to tailor MongoDB's backup and restore
functionality to suit your particular needs.
The mongodump utility includes the options shown in Figure 9-1 , captured by running help in MongoDB 2.5.3.
 
Search WWH ::




Custom Search