【问题标题】:Trouble connecting to MongoDB Atlas from Robo 3T从 Robo 3T 连接到 MongoDB Atlas 时出现问题
【发布时间】:2021-02-01 09:53:42
【问题描述】:

我创建了一个免费的Atlas 帐户并设置了一个集群。我正在尝试从Robo 3T GUI 连接到 atlas 集群。我做了如下配置,

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

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

SSH 未检查

TLS 设置为与自签名证书一起使用。

高级选项卡中未进行任何更改。

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

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

在 Atlas 帐户中,我已授予对所有 IP 的访问权限,

我还应该做什么才能从 Robo3T GUI 连接到 Atlas DB。

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

提前致谢。

【问题讨论】:

  • 嗯,奇怪,我好像无法登录自己...
  • 您是否在“身份验证”选项卡中提供了这些详细信息? 数据库: admin,用户名: 您的用户名,密码: 您的密码,Auth Mechanism: SCRAM-SHA -1
  • 是的,我有。使用的凭据具有管理员访问权限

标签: mongodb mongodb-atlas robo3t


【解决方案1】:

实际上,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)
}

所以我把set name从Cluster-shard-0改成了atlas-n8lsue-shard-0,现在连接成功了

【讨论】:

    【解决方案2】:

    试试这些:

    1. 转到 Atlas > 集群
    2. 点击“连接”按钮
    3. 使用 Mongo Compass 进行连接
    4. 你会看到mongodb+srv://...连接字符串。
    5. 复制/粘贴您的 Robo3T 来自 Srv

    你也可以试试 MongoDB Compass,它是比 Robo3T 更强大的工具。

    【讨论】:

    • 在连接字符串中,你不会看到副本集名称
    猜你喜欢
    • 2019-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-27
    • 2023-03-29
    • 2018-05-01
    • 2021-09-07
    相关资源
    最近更新 更多