The server is running perfectly locally, I can connect and execute commands, etc.
Now, I tried connecting remotely from another virtual machine on EC2 but I can't get to connect regardless how much I'm trying. At first I thought it was a problem of security groups, so I tried enabling all ports from within the group (both virtual machines belong to the same secirity groups) I also enabled connections in the iptables file (and yes, restarted the service) but it still doesn't work... Any ideas on what the problem could be?

Regarding the "bind_ip" setting, well.. there is no default value for that, I mean there even is no bind_ip line on the mongodb.conf, by default. I was probably expecting something like bind_ip = 127.0.0.1 so that I could comment it out, but it wasn't there, so I tried with bind_ip = 0.0.0.0 but still, it's not working either.

IP Address Binding
By default, a mongod server will listen on all available IP addresses on a machine. You can restrict this to a single IP address with the 'bind_ip' configuration option for mongod.

Typically, this would be set to 127.0.0.1, the loopback interface, to require that mongod only listen to requests from the same machine (localhost).

To enable listening on all interfaces, remove the bind_ip option from your server configuration file.

Update: I guess I was confused myself. I thought the default behavior was different than what was described above. (Maybe it used to be?) In any case, you should check your mongo config file to make sure that you have it configured as you expect.

oh yes, I checked on that too, regarding the "bind_ip" setting, well.. there is no default value for that, I mean there even is no bind_ip line on that, by default. I was probably expecting something like bind_ip = 127.0.0.1 but it wasn't there, so I tried with bind_ip = 0.0.0.0 but still, it's not working...
–
Enrico TuttobeneJan 6 '12 at 0:32

1

On Ubuntu, in the /etc/mongod.conf file, it says to simply remove the line that sets bind_ip altogether, and that will allow mongo to listen to all interfaces. (Commenting out this line fixed it for me).
–
KEWMay 23 '14 at 21:32

This did it for me , commenting out the bind_ip line worked. Thanks. Can't believe I wasted half hour for this
–
blueskin2 days ago