【发布时间】:2017-11-14 18:38:36
【问题描述】:
连接到 Mongodb 时出现此错误。我不太确定这是什么错误。
使用 CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Primary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } } 选择服务器 30000 毫秒后发生超时。集群状态的客户端视图是 { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "123.123.123.123: 27017“}”,端点:“123.123.123.123:27017”,状态:“断开连接”,类型:“未知”,HeartbeatException:“MongoDB.Driver.MongoConnectionException:打开与服务器的连接时发生异常。--- > MongoDB.Driver.MongoAuthenticationException:无法使用 sasl 协议机制 SCRAM-SHA-1 进行身份验证。---> MongoDB.Driver.MongoCommandException:命令 saslStart 失败:身份验证失败.. 在 MongoDB.Driver.Core.WireProtocol.CommandWireProtocol@987654321 @1 回复)在 MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.d__11.MoveNext() --- 从先前抛出异常的位置结束堆栈跟踪---在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotificat离子(任务任务)在 MongoDB.Driver.Core.Authentication.SaslAuthenticator.d__7.MoveNext() --- 内部异常堆栈跟踪结束 --- 在 MongoDB.Driver.Core.Authentication.SaslAuthenticator.d__7.MoveNext() - -- 从先前抛出异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 MongoDB.Driver.Core 的 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) .Authentication.AuthenticationHelper.d__1.MoveNext() --- 在 System.Runtime.CompilerServices.TaskAwaiter 的 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 处从先前引发异常的位置结束堆栈跟踪。 MongoDB.Driver.Core.Connections.ConnectionInitializer.d__3.MoveNext() 处的 HandleNonSuccessAndDebuggerNotification(Task task) --- 从先前引发异常的位置结束堆栈跟踪 --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Tas k task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MongoDB.Driver.Core.Connections.BinaryConnection.d__48.MoveNext() --- End of internal exception stack trace --- at MongoDB.Driver。 Core.Connections.BinaryConnection.d__48.MoveNext() --- 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 处的 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 处从先前引发异常的位置结束堆栈跟踪。 .HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at MongoDB.Driver.Core.Servers.ServerMonitor.d__27.MoveNext()" }] }
谁能帮帮我?
我使用的是 MongoDB 版本 3.4.4。
请,谢谢。
在 Mongodb 日志中,它说
来自客户端 111.111.111.111:12312 的 Grandnode 上的 usernameexample 的 SCRAM-SHA-1 身份验证失败; UserNotFound: 找不到用户 usernameexample@Grandnode
但 Grandnode 是我想在 Grandnode 项目中创建的数据库名称。
如何解决这个问题?
【问题讨论】:
-
该错误意味着您提供了不正确的身份验证凭据。检查您的用户名和密码是否有效。如果您相信您这样做并且可以验证这些凭据是否允许您从另一个客户端(例如 mongo shell)进行连接,那么请在您与您的问题建立连接的位置包含代码。这比堆栈跟踪更有用。
-
我可以通过 Robomongo 连接到 mongodb 服务器,但是在 c# 代码中它无法连接。
-
这个项目是 Grandnode,它已经在里面了。
-
在 Mongodb 日志中,它表示客户端 111.111.111.111:12312 的 Grandnode 上的 usernameexample 的 SCRAM-SHA-1 身份验证失败; UserNotFound: 找不到用户 usernameexample@Grandnode 但 Grandnode 是我想在 Grandnode 项目中创建的数据库名称。如何解决这个问题?