无法通过 mongo shell 连接到 mongodb 图集 [英] Cannot connect to mongodb atlas through mongo shell

查看:136
本文介绍了无法通过 mongo shell 连接到 mongodb 图集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查看了其他类似的帖子,但没有一个适合我的案例.

I've checked other similar posts but none worked for my case.

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

I upgraded my mongo shell right before connecting to MongoDB Atlas, from which I created a free sandbox database. I used this following for my connection, which was given by atlas.

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

数据库用户形象:

数据库概览的屏幕截图:

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

然而,终端显示这个(我只包含了大约 15 行,其余都是重复的.):

However, the terminal displays this (I only included about 15 lines, the rest are repetitions.):

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.

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

What could be the reason for this connection error?

推荐答案

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

Actually the reason why I couldn't connect is because I had a network restriction from my university's wifi. I was given a test url http://portquiz.net:27017 from MongoDB's support team, I opened it in a browser and I couldn't access it. I changed to another place with wifi and it worked.

这篇关于无法通过 mongo shell 连接到 mongodb 图集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆