I tried to set up Backups with mongodump command. I used this Tutorial: https://www.digitalocean.com/community/tutorials/how-to-back-up-restore-and-migrate-a-mongodb-database-on-ubuntu-14-04
But when i execute folowing command:
sudo mongodump --db newdb --out /var/backups/mongobackups/date +"%m-%d-%y"
I get this error:
Failed: error getting collections for database ibyc_db: error running listCollections. Database: ibyc_db Err: not authorized on ibyc_db to execute command { listCollections: 1, cursor: {} }
I am running a node.js application and it works fine. The application is able to write and read to the database.
Could someone help with the mongodump command?
Thx a lot
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You may need to provide a username and password to the mongodump command and also ensure that the user that you are using has the “backup” role on it which will provide the needed permissions.
From the official documentation for mongodump:
To run mongodump against a MongoDB deployment that has access control enabled, you must have privileges that grant find action for each database to back up. The built-in backup role provides the required privileges to perform backup of any and all databases.
Changed in version 3.2.1: The backup role provides additional privileges to back up the system.profile collections that exist when running with database profiling. Previously, users required an additional read access on this collection.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.