无法通过mongo shell连接到mongodb地图集

Dar*_*ius 9 mongodb mongo-shell mongodb-atlas

我检查了其他类似的帖子,但没有一个适合我的情况。

在连接到MongoDB Atlas之前,我升级了mongo shell,从中创建了一个免费的沙箱数据库。我将以下内容用于我的联系,这是由地图集提供的。

mongo "mongodb+srv://cluster0-z2lf6.mongodb.net/test" --authenticationDatabase admin --username <user> --password <password>
Run Code Online (Sandbox Code Playgroud)

数据库用户的图像: 数据库用户的图像

数据库概述的屏幕快照: 数据库概述的屏幕快照

这些是数据库的详细信息: 这些是数据库的细节

但是,终端显示此内容(我只包含了大约15行,其余为重复。):

MongoDB shell version v3.6.0
connecting to: mongodb+srv://cluster0-z2lf6.mongodb.net/test
2017-12-24T14:39:42.806+0800 I NETWORK  [thread1] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-z2lf6.mongodb.net.:27017,cluster0-shard-00-01-z2lf6.mongodb.net.:27017,cluster0-shard-00-02-z2lf6.mongodb.net.:27017
2017-12-24T14:39:42.990+0800 W NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 34.232.245.97:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:42.991+0800 W NETWORK  [thread1] Failed to connect to 35.168.27.238:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:43.492+0800 W NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Failed to connect to 52.20.90.64:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:43.492+0800 W NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Unable to reach primary for set Cluster0-shard-0
2017-12-24T14:39:43.492+0800 I NETWORK  [ReplicaSetMonitor-TaskExecutor-0] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
2017-12-24T14:39:43.997+0800 W NETWORK  [thread1] Failed to connect to 35.168.27.238:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:44.000+0800 W NETWORK  [thread1] Failed to connect to 34.232.245.97:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:44.003+0800 W NETWORK  [thread1] Failed to connect to 52.20.90.64:27017, in(checking socket for error after poll), reason: Connection refused
2017-12-24T14:39:44.004+0800 W NETWORK  [thread1] Unable to reach primary for set Cluster0-shard-0
2017-12-24T14:39:44.004+0800 I NETWORK  [thread1] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
Run Code Online (Sandbox Code Playgroud)

此连接错误的原因可能是什么?

gri*_*son 6

就我而言,原因是提供商更改了我的IP地址(我在NAT后面有动态IP)

更新IP白名单后,恢复了连接

在此处输入图片说明


Dar*_*ius 5

实际上,我无法连接的原因是因为我的大学无线网络受到网络限制。我http://portquiz.net:27017从MongoDB的支持团队获得了一个测试URL ,我在浏览器中将其打开,但无法访问。我改用wifi到另一个地方了,它起作用了。