My Sites


Friday, July 15, 2016

Mongo backup and authentication

mongodump -d myDatabase -o ~/backups/first_backup
$mongod --auth
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})

If you want to add without roles (optional):
db.createUser({user:"admin_name", pwd:"1234", roles:[]}) to check if authenticated or not:
db.auth("admin_name", "1234") it should give you:
1 else :
Error: Authentication failed. 0



mongo restore

mongorestore dump-2013-10-25/
https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/

install mongo
https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-amazon/


No comments:

Post a Comment