繁体   English   中英

尝试将环回 mongodb 连接器与 AWS DocumentDB 连接

[英]Trying to connect the loopback mongodb connector with AWS DocumentDB

所以嘿,我一直在尝试使用 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"

}}

通常超时是网络问题的结果,例如客户端位于不同的 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

在 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM