为什么我的 spring 应用程序不断打开到云图集 mongoDB 的新连接?

Why my spring Application keep on opening a new connection to cloud atlas mongoDB?

这些是我在应用程序启动

后反复收到的日志
2020-01-22T12:55:34,811 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:429, serverValue:273700}] to x:27017
2020-01-22T12:55:34,856 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:428, serverValue:275417}] to x:27017
2020-01-22T12:55:35,168 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Monitor thread successfully connected to server with description ServerDescription{address=x:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2, 2]}, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=181132909, setName='x-0', canonicalAddress=x:27017, hosts=[x:27017, x:27017, x:27017], passives=[], arbiters=[], primary='x:27017', tagSet=TagSet{[Tag{name='region', value='AP_SOUTH_1'}, Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}]}, electionId=7fffffff000000000000003e, setVersion=2, lastWriteDate=Wed Jan 22 12:55:30 IST 2020, lastUpdateTimeNanos=180151204451076}
2020-01-22T12:55:29,659 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:424, serverValue:276311}] to x:27017
2020-01-22T12:55:30,054 INFO  [cluster-ClusterId{value='5e27f56199adc55f60198440', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:425, serverValue:273700}] to x:27017
2020-01-22T12:55:33,603 INFO  [cluster-ClusterId{value='5e27f56199adc55f60198440', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:426, serverValue:278143}] to x:27017
2020-01-22T12:55:34,663 INFO  [cluster-ClusterId{value='5e27f56199adc55f60198440', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:427, serverValue:275417}] to x:27017
2020-01-22T12:55:34,742 INFO  [cluster-ClusterId{value='5e27f56199adc55f60198440', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Monitor thread successfully connected to server with description ServerDescription{address=x:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2, 2]}, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=133861489, setName='x-0', canonicalAddress=x:27017, hosts=[x:27017, x:27017, x:27017], passives=[], arbiters=[], primary='x:27017', tagSet=TagSet{[Tag{name='nodeType', value='ELECTABLE'}, Tag{name='provider', value='AWS'}, Tag{name='region', value='AP_SOUTH_1'}]}, electionId=7fffffff000000000000003e, setVersion=2, lastWriteDate=Wed Jan 22 12:55:30 IST 2020, lastUpdateTimeNanos=180150777860085}
2020-01-22T12:55:34,811 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:429, serverValue:273700}] to x:27017
2020-01-22T12:55:34,856 INFO  [cluster-ClusterId{value='5e27f56499adc55f60198441', description='null'}-x:27017] com.mongodb.diagnostics.logging.SLF4JLogger: Opened connection [connectionId{localValue:428, serverValue:275417}] to x:27017

集群是来自云mongo图集的M0。 每当我们将某些 ip 列入白名单时,连接数就会飙升到最大值 100 以上。 一旦我们从白名单中删除该 IP,连接就会断开。 奇怪的是,即使我们没有通过 I.P 上的 Web 服务器建立任何连接,连接也会激增。

这与监视器线程有关,即使它已连接但仍尝试重新连接。

我们之前遇到过类似的问题,即使我们只是将 IP 列入白名单,连接也会激增。这是一个奇怪的问题,因为我们没有从那个列入白名单的 IP 建立任何连接,连接仍然激增。

但解决方案很奇怪,我们重新启动其中一个开发者系统。 我们可以怀疑的是,他之前通过 NoSQL Booster、终端或通过本地调试部署有很多连接 itself.These 连接不会自行关闭,只要他的笔记本电脑连接到任何白名单 IP 就会出现。

解决奇怪情况的非常简单的方法。也许你可以试试重启系统。