Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-12369

Update mongodump and mongorestore to properly handle backing up users and roles in 2.6

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: Security, Tools, Usability
    • Labels:
      None
    • Fully Compatible
    • ALL

      Now that all user data is centralized in the admin database, doing single-db dumps with mongodump no longer properly capture the user definitions for users defined on that database, and mongorestore doesn't know how to properly restore users for a per-db dump either. Plus neither mongodump nor mongorestore know anything about restoring user-defined-role definitions.

      New proposal for interface for controlling how users/roles get dumped/restored:

      // dumps everything in the server
      mongodump -u dan -p xxx
      
      // dumps just the database (ignore users)
      mongodump -u dan -p xxx -d mydb
      
      // dumps database AND users and roles associated with mydb to /dump/admin/system.*  (what should this do against a < 2.6 db?)
      mongodump -u dan -p xxx -d mydb --dumpDbUsersAndRoles 
      
      // restore everything in the dump dir
      mongorestore -u dan -p xxx 
      
      // restore the db (ignore users)
      mongorestore -u dan -p xxx -d mydb 
      
      // restore the db as well as users stored in /dump/admin/system.* which apply to mydb (using normal mongorestore semantics)
      mongorestore -u dan -p xxx -d mydb --restoreDbUsersAndRoles 
      
      // restore the db as well as users stored in /dump/admin/system.* which apply to mydb (first clear out old users /oles)
      mongorestore -u dan -p xxx -d mydb --restoreDbUsersAndRoles --drop
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: