Database Reference
In-Depth Information
Most of the options listed here are self-explanatory, with the following exceptions:
--dbpath arg : If you have a large amount of data to back up and fast drives, and you aren't
concerned with backing up your indexes, it may be preferable to back up the database by
copying the datafiles that the MongoDB server uses directly to the backup medium. This
option allows you to back up directly from the server's datafiles, but it can only be used if the
server is offline or otherwise write-frozen (see the “Backing Up Large Databases” section later
in this chapter for more information).
--directoryperdb : You use this command-line option in conjunction with the --dbpath
option to specify that the MongoDB server being backed up was configured to place its
datafiles for each database in a separate directory. By default, MongoDB places all of its
datafiles in a single directory. You should use this option only if you have configured your
server to operate in this mode.
- o [ --out ] arg : You use this option to specify the directory where you want the database
dumps to be placed. By default, the mongodump utility creates a folder called /dump in the
current directory and writes the dumps into that. You can use the -o/--out option to choose
an alternative path to place the output dumps.
--authenticationDatabase arg : Specifies the database that holds the user's credentials.
Mongodump will default to using the databases specified with -db without this option.
--authenticationMechanism arg : Defaults to MongoDB's challenge/response (username/
password) mechanism. This command is used to switch to MongoDB Enterprise edition's
Kerberos authentication.
Restoring Individual Databases or Collections
You've just seen how the mongodump utility can back up a single database or collection; the mongorestore utility has
the same flexibility. You can use mongorestore to restore an item if the dump directory it is restoring from has the
backup files for the required collection or database in it; you don't need to restore all the items present in the backup.
If you wish, you can restore them individually.
Let's begin by looking at the options available in mongorestore , shown in Figure 9-2 .
 
Search WWH ::




Custom Search