无法通过 mongo shell 连接到 mongodb atlas

Cannot connect to mongodb atlas through mongo shell

我检查了其他类似的帖子,但 none 对我的情况有效。

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

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

数据库用户图片:

数据库概览截图:

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

但是,终端显示这个(我只包含了大约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.

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

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

我看到你的另一个 post 有人降级但试图联系你。

我不在我的电脑旁边,但我可以将我的凭据(作为学生)发送给你,看看你是否可以登录。在你的另一个 post 中,你问了一个关于数据模型和在哪里的问题得到类似的东西。

在 YouTube 上有一位来自欧洲的绅士的精彩 mongodb 教程。我在大学之前做过。你感兴趣吗?我可以帮你弄到 link 吗?这是相同的信息,但解释得更好。

不过(对我来说)必须是明天。我在台湾

其实我无法连接的原因是因为我大学的wifi有网络限制。 MongoDB 的支持团队给了我一个测试 url http://portquiz.net:27017,我在浏览器中打开它但无法访问它。 我换到另一个有 wifi 的地方,它工作正常。

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

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

新图集ui - 请注意,为了更好的安全性,您不应使用 0.0.0.0/0 或您自己的 ip 地址或使用可用计时器来终止规则