所以我一直在遵循此MongoDB教程,它告诉我使用Atlas MongoDB创建托管数据库,然后使用罗盘进行连接,但是在我填写了连接字段后,它总是显示此错误
Server selection timed out after 30000 ms
我的MongoDB服务器在后台运行,我尝试更改集群密码和此解决方案https://stackoverflow.com/a/60416687/11652306,但问题仍然存在。
我尝试通过mongo shell连接,它给了我这个日志
MongoDB shell version v4.4.1
Enter password:
connecting to: mongodb://cluster0-shard-00-00.kupeh.mongodb.net:27017,cluster0-shard-00-01.kupeh.mongodb.net:27017,cluster0-shard-00-02.kupeh.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-ty53k9-shard-0&ssl=true
{"t":{"$date":"2020-11-08T14:15:13.284Z"},"s":"W", "c":"NETWORK", "id":23019, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"DNS resolution while connecting to peer was slow","attr":{"peer":"cluster0-shard-00-00.kupeh.mongodb.net:27017","durationMillis":1302}}
{"t":{"$date":"2020-11-08T14:15:13.792Z"},"s":"W", "c":"NETWORK", "id":23019, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"DNS resolution while connecting to peer was slow","attr":{"peer":"cluster0-shard-00-02.kupeh.mongodb.net:27017","durationMillis":1810}}
{"t":{"$date":"2020-11-08T14:15:26.981Z"},"s":"I", "c":"NETWORK", "id":4333208, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM host selection timeout","attr":{"replicaSet":"atlas-ty53k9-shard-0","error":"FailedToSatisfyReadPreference: Could not find host matching read preference { mode: \"nearest\" } for set atlas-ty53k9-shard-0"}}
*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
Error: connect failed to replica set atlas-ty53k9-shard-0/cluster0-shard-00-00.kupeh.mongodb.net:27017,cluster0-shard-00-01.kupeh.mongodb.net:27017,cluster0-shard-00-02.kupeh.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
我正在使用: 窗户10 指南针版本1.20.5 MongoDB版本4.4.1