SASL authentication step: Authentication failed. wile restoring dump in 3.0 version for running wired tiger storage engine

6,350 views
Skip to first unread message

arun....@gmail.com

unread,
Feb 25, 2016, 3:21:54 AM2/25/16
to mongodb-user
I upgraded mongodb to 3.0 from 2.6 and ran mongodb in current instance of 3.0  and then took the dump

./mongodump --port 27018 -u u -p p  --out /home/as062a/mongodb/data_3.0.0_dump_backp

i ran storage engine after upgrading schema to SCRAM-SHA-1

> version()
3.0.0
> db.version()
3.0.0
> db.adminCommand({authSchemaUpgrade: 1});
{ "done" : true, "ok" : 1 }
>

then i ran storage engine
./mongod --port 27019 --storageEngine wiredTiger --dbpath /home/as062a/mongodb/data_3_0_wtiger --fork --logpath /home/as062a/mongodb/log/mongo_wire --auth

but am restoring the data from dump in new data dir of storage engine it givibng below error.. the user u is having root role.
./mongorestore --port 27019 -u u -p p --authenticationDatabase admin /home/as062a/mongodb/data_3.0.0_dump_backp
2016-02-24T14:32:32.923-0500 Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.

Ankur Raina

unread,
Mar 4, 2016, 2:27:28 AM3/4/16
to mongodb-user

Hi Arun,

I analysed your problem and simulated the same in my environment. The use of —auth while starting the new instance and -u u -p p —authenticationDatabase admin while running the mongorestore has resulted into this error. This is because you’ve provided username/password when there is no auth configured yet. You can think of MongoDB’s auth as always enabled but not configured, which means that if you provided user/password it will try to validate it. Please read Enable Client Access Control for more information regarding the use of —auth for enabling access control on MongoDB.

Here is what you can do:

  • Start the new mongod instance (in your case on port 27019) without using —auth

  • Then restore the previously taken mongodump to this instance without any username/password

  • Once done, restart the mongod with —auth enabled

  • You should now be able to use your previously authenticated user.

For upgrade recommendations and checklists from 2.6 to 3.0 please see Upgrade Recommendations and Checklists v3.0

Regards

Ankur

Reply all
Reply to author
Forward
0 new messages