MongoDB 3.0 Authentication Issue

We upgraded to MongoDB 3.0 version and that caused some of the tools that we used for visualization of Mongo data to stop working.  We use Robomongo at my workplace and it started failing with Authentication error.  The error I saw was as follows:

Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document

There is a JIRA ticket that is open on the Mongo Issue list which can be found here.  As mentioned in the issue, MONGODB_CR was an older authentication algorithm that was used prior to 3.x versions.  This causes third party tools to stop working when we move to Mongo 3.x because they still try to authenticate using the older mechanism instead of using the newer SCRAM-SHA-1.  I had to perform the following steps to fix the issue and it seems to have worked:

  1. Start MongoDB in non authenticated mode. From the command line, it will be the command
  2. mongod
  3. Switch to the admin database, which stores the usernames and passwords for all users that might need authentication.  If you are using some custom database to store the users, switch to that database
  4. use admin
  5. Now we need to change the authentication schema used for authentication to MONGODB_CR. The value assigned for newer schema is “5” and for the older one is “3”
  6. var schema = db.system.version.findOne({"_id" : "authSchema"})
    schema.currentVersion = 3

Once the above change is applied, I still was not able to use mongo with authentication. I had to drop and recreate existing users for Robomongo to successfully connect to mongo db in authenticated mode. Once the third party tools also upgrade to work with proper authentication, refer to the link here to again upgrade to using the SCRAM-SHA-1.


Got something to say?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s