我有一个mongodb和一个名为genbank的数据库。Genbank的用户角色是"read“和"readAnyDatabase”。非常奇怪的是,我不能通过MongoVUE通过这个角色连接到genbank,但是我可以在管理员角色下成功地连接。
连接配置是:

genbankReader是genbank数据库的用户名。
错误信息是:
Unable to connect to server *.*.*.*:40000: Invalid credential for database 'admin'..
Type: MongoDB.Driver.MongoConnectionException
Stack: 在 MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
在 MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
在 MongoDB.Driver.MongoServer.Connect()
在 MangoUI.MMongo.m7FnMeKibMFwcOmRDx4q(Object )
在 MangoUI.MMongo.Open(Boolean useSamus)
在 MangoUI.MMongo.Open()
在 MangoUI.ComNavTree.d0Pck1r6Vh91JYOyd29(Object )
在 MangoUI.ComNavTree.ExpandMe(MTreeNode expand)
在 MangoUI.ComNavTree.tree_BeforeExpand(Object sender, TreeViewCancelEventArgs e)
Invalid credential for database 'admin'.
Type: MongoDB.Driver.MongoAuthenticationException
Stack: 在 MongoDB.Driver.Communication.Security.MongoCRAuthenticationProtocol.Authenticate(MongoConnection connection, MongoCredential credential)
在 MongoDB.Driver.Communication.Security.Authenticator.Authenticate(MongoCredential credential)
在 MongoDB.Driver.Communication.Security.Authenticator.Authenticate()
在 MongoDB.Driver.Internal.MongoConnection.Open()
在 MongoDB.Driver.Internal.MongoConnection.GetNetworkStream()
在 MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
在 MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
在 MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, IBsonSerializer commandResultSerializer, IBsonSerializationOptions commandResultSerializationOptions, Boolean throwOnError)
在 MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError)
在 MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
在 MongoDB.Driver.MongoServerInstance.Connect()
在 MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
Command 'authenticate' failed: auth fails (response: { "code" : 18, "ok" : 0.0, "errmsg" : "auth fails" })
Type: MongoDB.Driver.MongoCommandException
Stack:
Inputs::
Command: authenticate
Ok: False
ErrorMsg: auth fails
Request: { "authenticate" : 1, "user" : "genbankReader", "nonce" : "264abe28fc4dd95", "key" : "ca2124ded060247d527941e55820fd80" }
Response: { "code" : 18, "ok" : 0.0, "errmsg" : "auth fails" }我的db用户总是使用mongoVUE,但除了read之外,我不能给他其他特权。有谁能帮我解决我的问题吗?
发布于 2014-02-04 06:45:55
你的错误看起来像是一个标准的“失败”的例外.如果您的连接的所有参数对您的设置都是正确的,我建议您尝试直接从mongo登录:$>mongo 1.2.3.4:40000/genbank -u genBankReader -p passwd1234 --authenticationDatabase admin --verbose使用--verbose标志作为“只读”用户和"admin“用户登录,并查看是否可以更多地了解错误(如果有的话)。
另外,您可以使用另一个mongo,如Robomongo,并查看它是否有效。(我以前使用MongoVue,但改用Robomongo,因为它不那么混乱,更面向shell)
否则,您可能设置/添加了错误的用户。使用admin用户检查适当数据库的db.system.users集合,以确保。也许再看看http://docs.mongodb.org/manual/reference/privilege-documents/
希望这能帮上忙祝你好运
https://dba.stackexchange.com/questions/57349
复制相似问题