|
Author:
{u'username': u'schmalliso', u'name': u'Allison Moore', u'email': u'allison.moore@10gen.com'}
Message: DOCS-1960: updates mongoexport, mongoimport, mongofiles with auth reqs
- updates mongoexport, mongoimport, mongorestore, mongodump,
and mongofiles to include the
permissions required to run them against a mongodb database
with auth enabled
- pulls out-of-date 'building the tools' section from mongosniff
- adds item to compatibility notes about deprecation of --journal
for tools
- updates backup with mongodump tutorial to not use deprecated option
Branch: master
https://github.com/mongodb/docs/commit/27e99a62fd2946f364f095f21a9fd9336dc31953
|
|
"userAdmin" is the role needed to restore user data to a single database
"readWrite" is the role needed to write normal data to a single database
"readWriteAnyDatabase" is the role needed to restore any/all databases
"userAdminAnyDatabase" is the role needed to restore user data to any/all databases
So this would work to restore a single database:
db.addUser( {
|
user: "restoreSingleDB",
|
pwd: "Moon1234",
|
roles: [ "readWrite", "userAdmin" ]
|
} )
|
mongorestore --db <database> --username restoreSingleDB --password Moon1234 <directory>/<database dump>
|
So this would work to restore all databases including user data:
db.addUser( {
|
user: "restoreAll",
|
pwd: "Moon1234",
|
roles: [ "readWriteAnyDatabase", "userAdminAnyDatabase" ]
|
} )
|
mongorestore --username restoreAll --password Moon1234 <directory>/<database dump>
|
Unfortunately, if you want to restore only the normal data and ignore the user data, you have to run the command one db at a time. This is probably a feature request.
|