【问题标题】:Trying to connect the loopback mongodb connector with AWS DocumentDB尝试将环回 mongodb 连接器与 AWS DocumentDB 连接
【发布时间】:2020-08-27 13:49:34
【问题描述】:

嘿,我一直在尝试使用 mongodb 环回连接器编辑 datasource.json 文件,以连接到启用了 TLS 的 AWS DocumentDB。我们正在从 OpenShift(部署在 AWS)和 AWS DocumentDB 实例进行连接。 VPC 对等互连已成功启用,我只能从 mongo pod 进行连接。目前我一直在尝试通过他们的 LoopBack 请求节点来使用 IBM App Connect Enterprise/IBM Integration Bus。 https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem 有一个公钥证书,但我认为它没有从下面的 datasource.json 文件中正确获取 -

{"mongodb" : {
"user":"user",
"password":"pw",
"host":"docdbURL",
"port":"27017",
"url":false,
"database": "sample_database",
"name": "mongodb",
"useNewUrlParser": true,
"ssl": true,
"sslValidate": true,
"checkServerIdentity": false,
"sslCA": "/pathTo/rds-combined-ca-bundle.pem",
"connector": "mongodb"

}}

【问题讨论】:

  • 您能否使用公钥证书从 MongoDB shell 连接到您的 DocumentDB 实例?
  • @meet-bhagdev 抱歉回复晚了,是的,我可以。我可以使用我连接到它的文件夹中的证书从 Pod 进入 DocumentDB 实例。

标签: mongodb amazon-web-services openshift loopbackjs aws-documentdb


【解决方案1】:

通常超时是由网络问题导致的,例如客户端位于不同的 VPC、不同的区域或安全组问题。有关网络连接故障排除的更多信息,请参阅:https://docs.aws.amazon.com/documentdb/latest/developerguide/troubleshooting.html

如果您认为它不是网络连接,并且认为它与您的 TLS 连接有关,那么最好通过关闭 TLS 来验证,看看您是否可以在没有从应用程序启用 TLS 的情况下成功连接。要禁用 TLS,请参阅:https://docs.aws.amazon.com/documentdb/latest/developerguide/security.encryption.ssl.html

【讨论】:

    【解决方案2】:

    在 JSON 文件中添加证书路径没有用(它不会读取文件的实际内容) 相反,您可以使用 'datasource.{environment}.js' 文件来读取证书的内容并将其添加到配置中。 通过以下方式,您可以使用 datasource.local.js

    var fs = require('fs');
    var path = require("path");
    var ca = [fs.readFileSync(path.resolve(__dirname, "./rds-combined-ca-bundle.pem"))];
    
    var datasourc ={
        mongodb : {
          user:"user",
          password:"pw",
          host:"docdbURL",
          port:"27017",
          url:false,
          database: "sample_database",
          name: "mongodb",
          useNewUrlParser: true,
          ssl: true,
          sslValidate: true,
          checkServerIdentity: false,
          sslCA: ca,
          connector: "mongodb"
        }
    };
    module.exports = datasourc;
    

    使用以下环回文档链接作为参考 https://loopback.io/doc/en/lb2/Environment-specific-configuration.html

    【讨论】:

      猜你喜欢
      • 2020-05-01
      • 2022-06-27
      • 2022-12-12
      • 2022-12-14
      • 1970-01-01
      • 2019-02-15
      • 2019-06-21
      • 2022-06-27
      • 2021-05-03
      相关资源
      最近更新 更多