在AWS EC2实例上安装了mongodb但无法连接到它

时间:2014-08-09 15:29:53

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

我在EC2 Amazon Linux实例上安装了MongoDB。我已经按照端口SSH 22和TCP 27017的打开方式设置了安全组。不幸的是,当我尝试从ssh控制台连接执行命令时

mongo <public-dns-name>:27107/test

我收到以下错误

connecting to: <public-dns-name>:27017/test
2014-08-09T15:25:07.966+0000 warning: Failed to connect to xxx.xx.xx.xx:27017, reason: errno:111 Connection refused
2014-08-09T15:25:07.967+0000 Error: couldn't connect to server <public-dns-name>:27017 (172.31.19.26), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed

1 个答案:

答案 0 :(得分:-1)

你可能需要使用nginx的流模块,因为默认的nginx设置,它需要http。