简体   繁体   English

连接猫鼬mongodb atlas ec2 aws

[英]connect mongoose mongodb atlas ec2 aws

If I connect from localhost, then everything is fine, if I connect from ec2 aws - error "[Error: No valid replicaset instance servers found]" 如果我从本地主机连接,则一切正常,如果我从ec2 aws连接-错误“ [错误:找不到有效的副本集实例服务器]”

code is the same, on localhost and on ec2 ubuntu 本地主机和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'); 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');

Have you tried enabling the port 27017 in the security groups on ec2 您是否尝试过在ec2的安全组中启用端口27017

在此处输入图片说明

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

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