[SERVER-17494] Issue with mongodb authentication mode. Created: 06/Mar/15  Updated: 13/Mar/15  Resolved: 13/Mar/15

Status: Closed
Project: Core Server
Component/s: Security, Sharding
Affects Version/s: 2.6.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Raja Vobugari Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CDRIVER-559 Issues in cluster authentication mod Closed
Operating System: ALL
Participants:

 Description   

Hi:
I tried to setup my mongoDB cluster in authentication mode. Was able to create a admin user with role "userAdminAnyDatabase" in "admin" db in not authentication mode. Once I turn on the authentication mode, any operation I perform, I get the following error for any action as the "admin" user.

{"error":"error creating initial database config information :: caused by :: can't find a shard to put new db on"}

Here is the complete procedure that we followed. Version of mongodb being used is 2.6.4.
http://docs.mongodb.org/manual/tutorial/deploy-replica-set-with-auth/

NOTE:
I had create two accounts one account namely "admin" with a role of "useAdminAnyDatabase" another account namely "superuser" with a role of "root". Both of them on admin database. I am able to create additional users using "admin" account, but not able to create a database or collections using either of them. This is the error I get...

mongos> use admin
switched to db admin
mongos> db.auth("superuser", "123456")
1
mongos> use xyz
switched to db xyz
mongos> db.createcollection("hello")
2015-03-06T08:39:08.778-0500 TypeError: Property 'createcollection' of object xyz is not a function
mongos> db.createCollection("hello")
2015-03-06T08:39:39.540-0500 error: {
"$err" : "error creating initial database config information :: caused by :: can't find a shard to put new db on",
"code" : 10185
} at src/mongo/shell/query.js:131

I look at the shard status...I see the following...

mongos> sh.status()
— Sharding Status —
sharding version: {
"_id" : 1,
"version" : 4,
"minCompatibleVersion" : 4,
"currentVersion" : 5,
"clusterId" : ObjectId("54f92c3fd77ac96ad05d5924")
}
shards:
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
mongos>

I am using Keyfile based authenticaiton.



 Comments   
Comment by Ramon Fernandez Marina [ 13/Mar/15 ]

raja.vobugari@altisource.com, the reason you see an error when running createCollection is because, as the output from sh.status() indicates, no shards have been added to your system yet.

Please review your setup and add at least one shard before you start inserting data.

Generated at Thu Feb 08 03:44:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.