I am working on backup recovery for MongoDB 3.4. We have an instance that is running and being used. I set up a instance for doing testing of the backup and recovery process. In order to get data I did mongodump for each database and copied the files to my test server. Each backup write files to a directory that has the same name as the database. I used the gzip option to make it easier to move the files around. I am having issues trying to do the mongorestore. Can someone give me the syntax for mongorestore?
Here is the dump command mongodump –port 27017 –authenticationDatabase admin -u my_admin_user -p password -o /backup_dir –gzip -d test_db
These are the directories with the contents of my_test_db
root@my_vm:~/mongodb_backup_full_data_dump > ls -l total 20 drwxr-xr-x. 2 root root 4096 Aug 24 13:30 admin drwxr-xr-x. 2 root root 4096 Aug 24 13:51 data1 drwxr-xr-x. 2 root root 4096 Aug 24 14:20 data2 drwxr-xr-x. 2 root root 4096 Aug 24 14:20 data3 drwxr-xr-x. 2 root root 4096 Aug 24 14:20 my_test_db root@my_vm:~/mongodb_backup_full_data_dump > ls -l ./my_test_db/* -rw-r--r--. 1 root root 24263 Aug 24 14:20 ./my_test_db/journal_entries.bson.gz -rw-r--r--. 1 root root 132 Aug 24 14:20 ./my_test_db/journal_entries.metadata.json.gz -rw-r--r--. 1 root root 481 Aug 24 14:20 ./my_test_db/journal_users.bson.gz -rw-r--r--. 1 root root 107 Aug 24 14:20 ./my_test_db/journal_users.metadata.json.gz -rw-r--r--. 1 root root 14438174 Aug 24 14:20 ./my_test_db/test_collection.bson.gz -rw-r--r--. 1 root root 104 Aug 24 14:20 ./my_test_db/test_collection.metadata.json.gz mongorestore --port 27017 --authenticationDatabase admin -u my_admin_user -p password -o /backup_dir \ --gzip -d test_db /root/mongodb_backup_full_data_dump/test_db/journal_entries.bson.gz 2017-08-25T15:24:05.487-0400 the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead 2017-08-25T15:24:05.487-0400 checking for collection data in /root/mongodb_backup_full_data_dump/mediax 2017-08-25T15:24:05.487-0400 Failed: error scanning filesystem: file /root/mongodb_backup_full_data_dump/mediax is a directory, not a bson file