我正在尝试从运行Windows10的Virtualbox连接到我的MongoDB Atlas集群。
以下是终端中打印出的内容:
Microsoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>mongo "mongodb+srv://cluster0-cd8gj.mongodb.net/test" --username xxxx
MongoDB shell version v4.0.10
Enter password:
connecting to: mongodb://cluster0-shard-00-00-cd8gj.mongodb.net.:27017,cluster0-shard-00-01-cd8gj.mongodb.net.:27017,cluster0-shard-00-02-cd8gj.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2019-07-18T17:58:13.929+0200 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-cd8gj.mongodb.net.:27017,cluster0-shard-00-01-cd8gj.mongodb.net.:27017,cluster0-shard-00-02-cd8gj.mongodb.net.:27017
2019-07-18T17:58:14.767+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:14.796+0200 I NETWORK [js] 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.
2019-07-18T17:58:15.654+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:15.654+0200 I NETWORK [js] 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.
2019-07-18T17:58:16.509+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:16.510+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row.
2019-07-18T17:58:17.400+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:17.519+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row.
2019-07-18T17:58:18.605+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:18.672+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 5 checks in a row.
2019-07-18T17:58:19.654+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:19.655+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 6 checks in a row.
2019-07-18T17:58:20.513+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:20.514+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 7 checks in a row.
2019-07-18T17:58:21.445+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:21.496+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 8 checks in a row.
2019-07-18T17:58:22.575+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:22.576+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 9 checks in a row.
2019-07-18T17:58:23.448+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:23.457+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 10 checks in a row.
2019-07-18T17:58:24.332+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:24.348+0200 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 11 checks in a row.
2019-07-18T17:58:25.281+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:26.206+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:27.062+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:27.926+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-07-18T17:58:28.790+0200 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.
2019-07-18T17:58:28.988+0200 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-cd8gj.mongodb.net.:27017,cluster0-shard-00-01-cd8gj.mongodb.net.:27017,cluster0-shard-00-02-cd8gj.mongodb.net.:27017 :
connect@src/mongo/shell/mongo.js:344:17
@(connect):2:6
exception: connect failed
================================================ =
任何朝着正确方向的指针都将受到赞赏。
================================================ =
我还可以补充一点,我已经在正在运行的Virtualbox上设置了本地MongoDB。