The document discusses various backup, restore, and disaster recovery strategies for MongoDB databases. It outlines options for backing up data using mongodump, copying database files, or taking filesystem snapshots. For restoring, it recommends using mongorestore which can replay oplog entries for point-in-time recovery. It also stresses the importance of testing restores. For disaster recovery, it suggests using replica sets for redundancy across multiple data centers and regions to avoid single points of failure.
7. mongodump
• Dumps collections to *.bson files
• Mirrors your structure
• Can be run in live or offline mode
• --dbpath for direct file access
• --oplog to dump oplog last PIT
• --query/filter selective dump
8. mongodump
$ mongodump --help
Export MongoDB data to BSON files.
options:
--help produce help message
-v [ --verbose ] be more verbose (include multiple times for more
verbosity e.g. -vvvvv)
--version print the program's version and exit
-h [ --host ] arg mongo host to connect to ( /s1,s2 for
--port arg server port. Can also use --host hostname
-u [ --username ] arg username
-p [ --password ] arg password
--dbpath arg directly access mongod database files in
path, instead of connecting to a mongod
needs to lock the data directory, so can
if a mongod is currently accessing the s
-d [ --db ] arg database to use
-c [ --collection ] arg collection to use (some commands)
-o [ --out ] arg (=dump)output directory or "-" for stdout
-q [ --query ] arg json query
--oplog Use oplog for point-in-time snapshotting