Unable to connect to Mongodb running on EC2

I cannot connect remotely to a mongo server running on EC2, although if I find ssh on the server, mongo is working correctly. Also note that port 27017 open for both tcp and udp protocols. I get the following error:

 MongoDB shell version: 2.4.8 connecting to: ec2-x...x-compute.amazonaws.com:27017/test Thu Sep 4 13:26:04.293 Error: couldn't connect to server to: ec2-x...x-compute.amazonaws.com:27017/test at src/mongo/shell/mongo.js:147 exception: connect failed 

I have Mongodb version 2.4.8 on my localhost and on the Mongodb version 2.6.4 server. Could version difference be a problem?

+7
mongodb amazon-web-services amazon-ec2
source share
1 answer

Do you bind to an external IP address? Or just localhost:

http://docs.mongodb.org/manual/reference/configuration-options/

 net: bindIp: 127.0.0.1 # Should be 0.0.0.0 to listen on all interfaces port: 27017 

In addition, I know that you said that the port is open. Have you checked this with nmap / netcat? You should check the AWS security group and local firewall to make sure it is open.

+21
source share

All Articles