首页 > 解决方案 > 如何从我的笔记本电脑访问 AWS EC2 Ubuntu 中的 Mongodb

问题描述

我发现无法访问托管在 AWS EC2 Ubuntu 中的 MongoDB 的问题。

我做了

#network interfaces
net:
  port: 27017
#bindIp: 127.0.0.1

security:
  authorization: 'enabled'

, 重启 MongoDb 并打开

Netword & Security -> Security Groups -> Inbound tab -> Edit button.
Make a new Custom TCP on port 27017, Source: Anywhere, 0.0.0.0/0

安全组。但是当我尝试访问时mongo -u user -p mypassword 52.221.226.195/mydb,发现以下错误表明连接被拒绝。请帮助我如何解决它。

2019-04-17T15:57:58.321+0630 E QUERY    [js] Error: couldn't connect to server xx.xxx.xxx.xxx:27017, connection attempt failed: SocketException: Error connecting to xx.xxx.xxx.xxx:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed 

标签: mongodbamazon-web-servicesamazon-ec2

解决方案


推荐阅读