连接mongoose mongodb atlas ec2 aws

时间:2017-09-13 14:55:23

标签: mongodb amazon-web-services amazon-ec2 mongoose

如果我从localhost连接,那么一切都很好, 如果我从ec2 aws连接 - 错误" [错误:找不到有效的replicaset实例服务器]"

代码在localhost和ec2 ubuntu上是相同的

mongoose.connect(' mongodb的://:@ cluster0-shard-00-00-llnwa.mongodb.net:27017,cluster0-shard-00-01-llnwa.mongodb.net:27017,cluster0 -shard-00-02-llnwa.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin');

1 个答案:

答案 0 :(得分:0)

您是否尝试在ec2的安全组中启用端口27017

enter image description here