Can't access Mongodb running on an ASW EC2 Instance

105 views
Skip to first unread message

md

unread,
Feb 24, 2015, 11:02:06 PM2/24/15
to mongod...@googlegroups.com
I have mongodb v2.6 installed on an ASW EC2 instance running Red Hat Liinux. It's a very basic instance, no shards,  no replicas no admin type security and it's listining on port 27017. When I log into the linux instance and run "mongo localhost:27017/test" I have no issue but when I try the same thing external to ASW, "mongo 123.234.345.456:27017/test" I get the response "Error: couldn't connect to server 123.234.345.456:27017 (123.234.345.456), connection attempt failed at src/mongo/shell/mongo.js:148".

Additionally for the EC2 instance I've set up a security group opening port 27017 both to just my external ip and to the world and the result is always as stated above.

Any guidance appreciated...

md

Stephen Steneker

unread,
Feb 26, 2015, 8:13:00 AM2/26/15
to mongod...@googlegroups.com
On Wednesday, 25 February 2015 15:02:06 UTC+11, md wrote:
I have mongodb v2.6 installed on an ASW EC2 instance running Red Hat Liinux. It's a very basic instance, no shards,  no replicas no admin type security and it's listining on port 27017. When I log into the linux instance and run "mongo localhost:27017/test" I have no issue but when I try the same thing external to ASW, "mongo 123.234.345.456:27017/test" I get the response "Error: couldn't connect to server 123.234.345.456:27017 (123.234.345.456), connection attempt failed at src/mongo/shell/mongo.js:148".

Additionally for the EC2 instance I've set up a security group opening port 27017 both to just my external ip and to the world and the result is always as stated above.

Hi,

Have you updated or commented out the bind_ip value in /etc/mongod.conf (and restarted the mongod service)?

The standard MongoDB 2.6 packages only listen to the local network interface by default.

Note: if you are opening 27017 to the world (or even just the network beyond localhost), you should definitely have a read of the security checklist for best practices: http://docs.mongodb.org/manual/administration/security-checklist/

Regards,
Stephen

md

unread,
Feb 26, 2015, 10:24:06 PM2/26/15
to mongod...@googlegroups.com
I commented out the binding, saved it, shutdown the server and restarted the service. Opened, for a moment, access to the world and I still mongo will not connect and the error message is the same. 

FWIW I can ssh into the instance but cannot ping it...

Thanks,
md
Reply all
Reply to author
Forward
0 new messages