本文介绍了使用.Net mongodb驱动程序托管ubuntu 16.04 LTS时,Atlas MongoDB获取超时发生在30000ms之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从具有mongo驱动程序2.7.3的本地系统.NET标准2.0连接到Atlas mongodb并列出更改流的工作情况.
From local system .NET standard 2.0 with mongo driver 2.7.3 connecting to Atlas mongodb and listing change stream working.
当我在ubuntu 16.04 LTS上部署相同的系统时,它抛出以下错误.
When i deploy the same system on to ubuntu 16.04 LTS it is throwing below error.
连接字符串:
mongodb://xxxxxx:xxxxx@mycluster-shard-00-00-
xxxx.mongodb.net:27017,mycluster-shard-00-01-
xxxx.mongodb.net:27017,mycluster-shard-00-02-xxxx.mongodb.net:27017/test?ssl=true&
replicaSet=Cluster-shard-0&retryWrites=true
错误:
A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }.
Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/mycluster-shard-00-00-xxxx.mongodb.net:27017" }", EndPoint: "U
nspecified/mycluster-shard-00-00-xxxx.mongodb.net:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.IO.IOException: Th
e authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.#012 at Mono.Security.Protocol.Tls.RecordProtocol.E
ndReceiveRecord (System.IAsyncResult asyncResult) [0x00037] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012 at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in <081f2539f5f74de086
ddfa5e875c2fff>:0 #012 at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012 --- End of inner exception stack trace ---#012 at Mono.Security.Protocol.Tls.SslClient
Stream.EndNegotiateHandshake (System.IAsyncResult result) [0x00032] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012 at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (System.IAsyncResult asyncResult) [0x0000c] in <081f2539f5f74de086ddfa5e875c2
fff>:0 #012 --- End of inner exception stack trace ---#012 at Mono.Security.Protocol.Tls.SslStreamBase.EndRead (System.IAsyncResult asyncResult) [0x0004b] in <081f2539f5f74de086ddfa5e875c2fff>:0 #012 at Mono.Net.Security.Private.LegacySslStream.EndAuthenticate
AsClient (System.IAsyncResult asyncResult) [0x0000e] in <8ad536febd8d4466a395baa742076330>:0 #012 at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func`2[T,TResult] endFunction, System.Action`1[T] endActio
n, System.Threading.Tasks.Task`1[TResult] promise, System.Boolean requiresSynchronization) [0x00019] in <f5397d5e4dd146a1b2f33671be050366>:0 #012--- End of stack trace from previous location where exception was thrown ---#012 at System.Runtime.ExceptionService
s.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runti
me.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [
0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+ConfiguredTaskAwaiter.GetResult () [0x00000] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at MongoDB.Driver.Core.Connections.SslStreamFactory+<Cre
ateStreamAsync>d__4.MoveNext () [0x00182] in <50e51985348f46898d8a3c7759e943e8>:0 #012--- End of stack trace from previous location where exception was thrown ---#012 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd1
46a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebugger
Notification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at Syst
em.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__48.MoveNext () [0x000b6] in <50e
51985348f46898d8a3c7759e943e8>:0 #012 --- End of inner exception stack trace ---#012 at MongoDB.Driver.Core.Connections.BinaryConnection+<OpenHelperAsync>d__48.MoveNext () [0x001b4] in <50e51985348f46898d8a3c7759e943e8>:0 #012--- End of stack trace from previou
s location where exception was thrown ---#012 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.T
ask task) [0x0003e] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime
.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <f5397d5e4dd146a1b2f33671be050366>:0 #012 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable+Config
堆栈跟踪:
at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, MongoDB.Driver.Core.Clusters.ClusterDescription description) [0x00013] in <50e51985348f46898d8a3
c7759e943e8>:0 #012 at MongoDB.Driver.Core.Clusters.Cluster+WaitForDescriptionChangedHelper.HandleCompletedTask (System.Threading.Tasks.Task completedTask) [0x00009] in <50e51985348f46898d8a3c7759e943e8>:0 #012 at MongoDB.Driver.Core.Clusters.Cluster.WaitForD
escriptionChanged (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, MongoDB.Driver.Core.Clusters.ClusterDescription description, System.Threading.Tasks.Task descriptionChangedTask, System.TimeSpan timeout, System.Threading.Cancellati
onToken cancellationToken) [0x00021] in <50e51985348f46898d8a3c7759e943e8>:0 #012 at MongoDB.Driver.Core.Clusters.Cluster.SelectServer (MongoDB.Driver.Core.Clusters.ServerSelectors.IServerSelector selector, System.Threading.CancellationToken cancellationTok
en) [0x00057] in <50e51985348f46898d8a3c7759e943e8>:0 #012 at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection (System.Threading.CancellationToken cancellationToken) [0x00006] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at MongoDB.Driver.M
ongoClient.AreSessionsSupported (System.Threading.CancellationToken cancellationToken) [0x0001b] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at MongoDB.Driver.MongoClient.StartImplicitSession (System.Threading.CancellationToken cancellationToken) [0x00000]
in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at MongoDB.Driver.OperationExecutor.StartImplicitSession (System.Threading.CancellationToken cancellationToken) [0x00000] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at MongoDB.Driver.MongoCollectionImpl`1[TDocum
ent].UsingImplicitSession[TResult] (System.Func`2[T,TResult] func, System.Threading.CancellationToken cancellationToken) [0x00000] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at MongoDB.Driver.MongoCollectionImpl`1[TDocument].Watch[TResult] (MongoDB.Driver
.PipelineDefinition`2[TInput,TOutput] pipeline, MongoDB.Driver.ChangeStreamOptions options, System.Threading.CancellationToken cancellationToken) [0x0002f] in <e62075b47b974b1bb87a7dfdf33dbed3>:0 #012 at StateDataStore.CloudControlRoomState.Listen () [0x001
41] in <97005dd8325444bca5185303cdcf2ece>:0
Warning: Failed to connect to the agentx master agent ([NIL]):
enter code here
任何帮助!
推荐答案
MongoDb Atlas免费软件不支持变更流,这就是我们面临此问题的原因.
MongoDb Atlas freeware not supporting change streams, that's why we were faced this issue.
当MongoDb安装在AWS EC2实例中时,它可以正常工作,我们能够连接和侦听变更流.
It's working fine when MongoDb installed in AWS EC2 instance, we are able to connect and listen change streams.
这篇关于使用.Net mongodb驱动程序托管ubuntu 16.04 LTS时,Atlas MongoDB获取超时发生在30000ms之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!