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

时间:2017-12-24 06:59:15

标签: mongodb mongo-shell mongodb-atlas

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

我在连接到MongoDB Atlas之前就升级了我的mongo shell,我从中创建了一个免费的沙盒数据库。我使用以下内容进行连接,由atlas提供。

mongo "mongodb+srv://cluster0-z2lf6.mongodb.net/test" --authenticationDatabase admin --username <user> --password <password>

数据库用户的图片: image of the user of database

数据库概述的屏幕截图: screenshot of the overview of the database

以下是数据库的详细信息: These are the detail of database

然而,终端显示这个(我只包括大约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.

这种连接错误的原因是什么?

4 个答案:

答案 0 :(得分:4)

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

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

enter image description here

答案 1 :(得分:3)

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

答案 2 :(得分:1)

新的Atlas用户界面-请注意,为提高安全性,您不应使用自己的IP地址使用0.0.0.0/0螺母或使用可用的计时器来终止规则

enter image description here

答案 3 :(得分:-2)

我想我和你在同一个证书课上。我刚刚结束证书的日期是12月12日。

我看到你的另一篇文章说人们降级但试图联系你。

我不在我的电脑附近,但我可以向你发送我的凭证(作为学生),看看你是否可以登录。在你的另一篇文章中,你问了一个关于数据模型的问题以及在哪里得到类似的东西。

在YouTube上,来自欧洲的绅士提供了一个非常棒的mongodb教程。我是在大学之前做过的。你感兴趣吗?我能为你找到链接吗?这是相同的信息,但更好地解释。

但是,它必须是明天(对我而言)。我在台湾。

相关问题