Friday, November 11, 2016

MongoDB - Migrating MONGODB-CR to SCRAM-SHA-1



donghua@database:~$ mongo
MongoDB shell version: 3.2.10
connecting to: test
MongoDB Enterprise > db.system.users.find().pretty()
MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.system.users.find().pretty()
{
        "_id" : "admin.Jim",
        "user" : "Jim",
        "db" : "admin",
        "credentials" : {
                "MONGODB-CR" : "b2d1852f112d209beb4b60a128da1bd2"
        },
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}
MongoDB Enterprise > db.adminCommand({authSchemaUpgrade: 1})
{ "done" : true, "ok" : 1 }
MongoDB Enterprise >  db.system.users.find().pretty()
{
        "_id" : "admin.Jim",
        "user" : "Jim",
        "db" : "admin",
        "credentials" : {
                "SCRAM-SHA-1" : {
                        "iterationCount" : 10000,
                        "salt" : "cSgWaWisNIjQnV/fkYXQrA==",
                        "storedKey" : "PjLxiQIgq5/HWqhaIcE7tK1dkvg=",
                        "serverKey" : "t6jiG68AqGVW+M49KgUfnNI5GV0="
                }
        },
        "roles" : [
                {
                        "role" : "root",
                        "db" : "admin"
                }
        ]
}

No comments:

Post a Comment