Hello,
For the past few days i’ve been trying to backup my mongodb machine using mongodump.
The dump itself works just fine but when restored to a different machine to make sure the db was backed up fully I see that the users and all the settings were not moved.
My questions are as follows:
1.Is there a way to fully mongodump a db with all its users/roles/configs so after the restore I’ll basically have the same db to work on?
2.Where are the users and roles file/config located at?
3.Am I doing the backup restore correctly or is there a better way to do so?
thanks
So if I export this using mongodump and restoring them I should have the same users and roles?
Am I able to mongodump both collections at once? I tried using comma to separate between
using this command to backup
mongodump --db –username --password p --out /mongobackup/dump/mongobackup_$( date ‘+%Y-%m-%d_%H-%M-%S’ ) &> /mongobackup/backupout
If you are dumping a specific database you will want to use mongodump’s --dumpDbUsersAndRoles option and use the corresponding mongorestore --restoreDbUsersAndRoles option.
If you are mongodumping a whole instance the roles and uses are included.
Thanks yeah I finally understood that and that my users/roles are stored in the Admin DB.
I wasn’t able to mongodump the full instance but when dumping and restoring my DB and the Admin DB it worked like a charm.Mongodump requires me to input a db name.
On more thing can I use mongodump with a different authentication method and not use username/password since it’s just saved in plain text.
I couldn’t find the --config option when trying mongodump is it possible its missing on version 3.4.2.2?
Am I able to download just this ‘tool’ with a higher version but keep the DB itself with the old?
I will also be checking hte x509 authentication method