1. Data backup:
Mongodump-h dbhost-d Dbname-o dbdirectory
Parameter description:
-H:mongdb server address, for example:127.0.0.1, of course, you can specify the port number:127.0.0.1:27017
-D: The database instance that needs to be backed up, for example:test
-o: The data storage location of the backup, for example:c:\data\dump, of course, the directory needs to be established in advance, after the backup is completed, the system automatically in the dump directory to establish a Test Directory in which the backup data for the database instance is stored.
Examples of Use:
D:\Program_Files\MongoDB\bin\mongodump-h 127.0.0.1-d Users-o D:\mongodb\data\bak
2. Data recovery:
Mongorestore-h dbhost-d dbname--directoryperdb dbdirectory
Parameter description:
-H:MongoDB server address
-D: The database instance that needs to be restored, for example:test, and of course the name can be different from the backup time, such as test2
--directoryperdb: Where to back up your data, for example:c:\data\dump\test
--drop: When recovering, delete the current data and then restore the backed up data. That is, after the recovery, add the modified data after the backup will be deleted, use with caution Oh!
MongoDB Data Backup and recovery