Hi Team,
I was created User on MongoS my shard server after the user name and pwd does not move into shard servers , actually we have 2 shards one mongos and one config server.
please briefly explaining me where i was missed
Why user name does not replicate into shard server what is the process of create user in MongoDB Shard .
MongoDB Enterprise mongos> use admin
switched to db admin
MongoDB Enterprise mongos> db.createUser({user:"test",pwd:"123",roles:[{role:"root",db:"admin"}]})
Successfully added user: {
"user" : "test",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
MongoDB Enterprise mongos>
After created User in Mongos and connecting to one of the my shard server same user name but gettinf below error.
C:\mongodb_enterprise\mongodb\bin>mongo --port 27017 -u test -p 123 --authenticationDatabase admin
MongoDB shell version v4.0.4
connecting to: mongodb://127.0.0.1:27017/
Implicit session: session { "id" : UUID("05388006-86a3-4d28-b88b-b06599e2c18b") }
MongoDB server version: 4.0.4
2021-07-30T23:11:50.870+0530 E QUERY [js] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1685:20
@(auth):6:1
@(auth):1:2
exception: login failed
C:\mongodb_enterprise\mongodb\bin>
Please notice my current shards above created same username connected as MongoS server
MongoDB Enterprise mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("60b4fdbfee39817673277920")
}
shards:
{ "_id" : "rps", "host" : "rps/localhost:28001,localhost:28002", "state" : 1 }
{ "_id" : "rps1", "host" : "rps1/localhost:27017,localhost:27018", "state" : 1 }
active mongoses:
"4.0.4" : 1
autosplit:
Currently enabled: yes