mongodb - 无法通过 mongo shell 连接到 mongodb atlas

标签 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.

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

最佳答案

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

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

enter image description here

关于mongodb - 无法通过 mongo shell 连接到 mongodb atlas,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47958683/

相关文章:

mongodb - 带有 MongoDB 的重复事件模式

javascript - mongodb 服务器端 javascript 实际上是客户端?

python - App Engine,pymongo.errors.ServerSelectionTimeoutError : connection closed, 连接已关闭,连接已关闭”

mongodb - mongodb 的嵌套聚合管道

javascript - Mongoose.populate() 返回空数组而不是数据

c# - 反序列化嵌套和非结构化 BsonDocument(mongodb c# 驱动程序)

带有 OS Catalina 的 MongoDB 服务器

mongodb - 将较新的 Mongo shell 版本与较旧的 MongoDB 版本一起使用安全吗?

mongodb - 如何将 MongoDb atlas 数据库与 Jaspersoft studio 连接

MongoDB Atlas : user is not allowed to do action find on system. 索引