Note: In the backup file directory selection, there is a condition that the file directory, no matter how deep, can only have one file, (that is, except for the backup file can only exist folder, this condition constrains its entire directory tree)
Data backup:
/mongodump--host 127.0.0.1:27017-d lanzhoudb-o/data/mongodb/data/--directoryperdb
Where:--host 127.0.0.1:27017 as host port
-D Panodb for the database to be backed up
-o/data/mongodb/data/for backup Files directory (backup file directory Please select the hanging directory, but because of the above constraints, the hanging disk must be an empty disk, which saves the backup file copy time)
Data recovery:
Mongorestore--db Lanzhoudb/data/mongodb/data/lanzhoudb
Where:--db Shanxidb is the name of the database to be restored is LANZHOUDB
/data/mongodb/data/lanzhoudb the folder where the backup file is stored, and the table name is automatically generated after the backup
MongoDB Backup Recovery