【发布时间】:2022-02-20 21:21:14
【问题描述】:
我已经使用这些帖子成功地在 lightsail 上托管了一个 MongoDB 数据库:
另外,使用 robo3T 成功连接。
但是,无法确定 mongoURI,以便从 nodejs 服务器建立连接。
据此post:
mongoURI 是:'mongodb://<sample-user>:<password>@sample-cluster.node.us-east-1.docdb.amazonaws.com:27017/sample-database?', { tlsCAFile: `rds-combined-ca-bundle.pem` },
但是,不知道<sample-cluster> 和<node> 是什么。
Lightsail 的服务端点是:lightsail.ap-south-1.amazonaws.comamazon docs
robo3T 上的 db.hostInfo(),将主机名指定为:ip-xxx-xx-xx-xxx.ap-south-1.compute.internal(如果很重要)
所以尝试了这个:mongodb://admin:password@ip-xxx-xx-xx-xxx.lightsail.ap-south-1.amazonaws.com:27017/sample-database?retryWrites=true&w=majority ,但得到了MongooseServerSelectionError
什么是正确的 mongoURI? 感谢您的帮助。
另外,有没有人尝试在 Lightsail 上运行 mongo?您在成本和维护方面有何经验?
【问题讨论】:
标签: node.js mongodb amazon-web-services amazon-lightsail robo3t