从Robo 3T连接到MongoDB Atlas出现问题

时间:2020-10-18 12:48:07

标签: mongodb mongodb-atlas robo3t

我已经创建了一个免费的Atlas帐户并设置了一个集群。我正在尝试从Robo 3T GUI连接到地图集集群。我进行了以下配置,

在连接选项卡中,我指定了所有类型设置为Replica Set的群集节点 enter image description here

在“身份验证”选项卡中,我提供了管理员用户的凭据。

未选中SSH

TLS设置为与自签名证书一起使用。 enter image description here

“高级”标签中未进行任何更改。

但是当我尝试连接时,它失败并显示以下错误,

6:03:06 PM  Info: Settings saved to: /Users/sandeshaj/.3T/robo-3t/1.4.1/robo3t.json
6:03:06 PM  Info: Connecting to digify [Replica Set]cluster0-shard-00-02.hfjr8.mongodb.net:27017...
6:03:06 PM  Info: Settings saved to: /Users/sandeshaj/.3T/robo-3t/1.4.1/robo3t.json
6:03:24 PM  Info: Settings saved to: /Users/sandeshaj/.3T/robo-3t/1.4.1/robo3t.json
6:03:24 PM  Info: Replica set's cached set name cleared. Using user entered set name.
6:06:14 PM  Error: Establish connection failed. TLS tunnel failure: Network is unreachable or TLS connection rejected by server. Reason: Connect failed. Connection: digify
6:06:14 PM  Warning: Failed to ping the server. Could not find host matching read preference { mode: "primary", tags: [ {} ] } for set cluster0-shard-00-00

enter image description here

在Atlas帐户中,我可以访问所有IP,enter image description here

从Robo3T GUI连接到Atlas DB还要做什么?

PS:我什至尝试取消选中TLS。另外,按照设置我为应用程序https://github.com/digifi-io/loan-origination-system做的设置中的建议将设置名称设置为cluster0-shard-0

谢谢。

2 个答案:

答案 0 :(得分:0)

尝试以下方法:

  1. 转到地图集>群集
  2. 点击“连接”按钮
  3. 使用Mongo Compass连接
  4. 然后您将看到mongodb+srv://...连接字符串。
  5. 复制/粘贴Robo3T 从Srv

您还可以尝试MongoDB Compass,它比Robo3T更加强大。

答案 1 :(得分:0)

实际上,Atlas中的副本集名称与我在Robo 3T中提供的名称不同。当我在shell上执行db.runCommand( { isMaster: 1 } )时,它给出了以下输出,

{
    "hosts" : [
        "cluster0-shard-00-00.hfjr8.mongodb.net:27017",
        "cluster0-shard-00-01.hfjr8.mongodb.net:27017",
        "cluster0-shard-00-02.hfjr8.mongodb.net:27017"
    ],
    "setName" : "atlas-n8lsue-shard-0",
    "setVersion" : 2,
    "ismaster" : true,
    "secondary" : false,
    "primary" : "cluster0-shard-00-02.hfjr8.mongodb.net:27017",
    "tags" : {
        "provider" : "AWS",
        "nodeType" : "ELECTABLE",
        "workloadType" : "OPERATIONAL",
        "region" : "US_EAST_1"
    },
    "me" : "cluster0-shard-00-02.hfjr8.mongodb.net:27017",
    "electionId" : ObjectId("7fffffff0000000000000006"),
    "lastWrite" : {
        "opTime" : {
            "ts" : Timestamp(1603813903, 3),
            "t" : NumberLong(6)
        },
        "lastWriteDate" : ISODate("2020-10-27T15:51:43Z"),
        "majorityOpTime" : {
            "ts" : Timestamp(1603813903, 3),
            "t" : NumberLong(6)
        },
        "majorityWriteDate" : ISODate("2020-10-27T15:51:43Z")
    },
    "maxBsonObjectSize" : 16777216,
    "maxMessageSizeBytes" : 48000000,
    "maxWriteBatchSize" : 100000,
    "localTime" : ISODate("2020-10-27T15:51:47.854Z"),
    "logicalSessionTimeoutMinutes" : 30,
    "connectionId" : 643442,
    "minWireVersion" : 0,
    "maxWireVersion" : 8,
    "readOnly" : false,
    "ok" : 1,
    "$clusterTime" : {
        "clusterTime" : Timestamp(1603813903, 3),
        "signature" : {
            "hash" : BinData(0,"ZQK/mzsowFmDfsrDc4kfXBAXIl4="),
            "keyId" : NumberLong("6875773608992440322")
        }
    },
    "operationTime" : Timestamp(1603813903, 3)
}

因此我将设置名称从atlas-n8lsue-shard-0更改为Cluster-shard-0,现在连接已成功