Uploaded image for project: 'MongoDB ETL Tools'
  1. MongoDB ETL Tools
  2. TOOLS-760

can't restore users

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: 3.0.2
    • Fix Version/s: None
    • Component/s: None
    • Environment:
      Linux 64 Bit, wheezy

      Description

      We dumped everything from a v2.6.4 sharded system to restore it on a v3.0.2 sharded system. The users got not restored. The role of the user doing the dump and restore was root.
      Since the users were not restored, we tried to restore the admin database which didn't work either. Also restoring only system.users didn't work:

      14:54:27]root@s516 puppet /home/admin# mongorestore --host s516:27017 -uadmin -pXXX -d admin /data/dump_b30/admin/
      2015-05-28T14:54:47.983+0200	building a list of collections to restore from /data/dump_b30/admin/ dir
      2015-05-28T14:54:47.985+0200	reading metadata file from /data/dump_b30/admin/system.new_users.meta	data.json
      2015-05-28T14:54:47.985+0200	reading metadata file from /data/dump_b30/admin/system.backup_users.metadata.json
      2015-05-28T14:54:47.985+0200	restoring admin.system.new_users from file /data/dump_b30/admin/system.new_users.bson
      2015-05-28T14:54:47.985+0200	restoring admin.system.backup_users from file /data/dump_b30/admin/system.backup_users.bson
      2015-05-28T14:54:47.986+0200	error: Writes to config servers must have batch size of 1, found 5
      2015-05-28T14:54:47.986+0200	restoring indexes for collection admin.system.backup_users from metadata
      2015-05-28T14:54:47.987+0200	finished restoring admin.system.backup_users
      2015-05-28T14:54:48.001+0200	error: Writes to config servers must have batch size of 1, found 273
      2015-05-28T14:54:48.001+0200	restoring indexes for collection admin.system.new_users from metadata
      2015-05-28T14:54:48.046+0200	finished restoring admin.system.new_users
      2015-05-28T14:54:48.046+0200	restoring users from /data/dump_b30/admin/system.users.bson
      2015-05-28T14:54:48.048+0200	error: Writes to config servers must have batch size of 1, found 368
      2015-05-28T14:54:48.848+0200	error dropping temporary collection tempusers: exception: write $cmd failed on a node: { "ok" : 0, "errmsg" : "ns not found" } s516.ipx:27019 (172.16.66.81) ns: admin.$cmd cmd: { drop: "tempusers" }
      2015-05-28T14:54:48.848+0200	restoring roles from /data/dump_b30/admin/system.roles.bson
      2015-05-28T14:54:48.848+0200	roles file '/data/dump_b30/admin/system.roles.bson' is empty; skipping roles restoration
      2015-05-28T14:54:48.848+0200	done
      [14:54:48]root@s516 puppet /home/admin# mongorestore --host s516:27017 -uadmin -pXXX -d admin /data/dump_b30/admin/system.users.bson
      2015-05-28T14:55:00.942+0200	checking for collection data in /data/dump_b30/admin/system.users.bson
      2015-05-28T14:55:00.942+0200	assuming users in the dump directory are from <= 2.4 (auth version 1)
      2015-05-28T14:55:00.942+0200	Failed: the users and roles collections in the dump have an incompatible auth version with target server: cannot restore users of auth version 1 to a server of auth version 5
      [14:55:00]root@s516 puppet /home/admin# mongo s516:27017/admin -uadmin -pXXX
      MongoDB shell version: 3.0.2
      connecting to: s516:27017/admin
      mongos> db.version()
      3.0.2
      mongos> db.system.version.find()
      { "_id" : "authSchema", "currentVersion" : 5 }
      mongos> ^C
      bye
      [14:55:14]root@s516 puppet /home/admin# mongo b30.lvl.bln:27017/admin -uadmin -pXXX
      MongoDB shell version: 3.0.2
      connecting to: b30.lvl.bln:27017/admin
      mongos> db.version()
      2.6.4
      mongos> db.system.version.find()
      { "_id" : "authSchema", "currentVersion" : 3 }
      mongos> ^C
      bye


      The only solution we found was to dump every single database using the mongodump option --dumpDbUsersAndRoles and restore them one by one using the mongorestore option --restoreDbUsersAndRoles. The latter required to add the role "restore" to the root user.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kyle.erf Kyle Erf
                Reporter:
                kaga kay.agahd
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: