mongoDB won't connect remotely

Hopefully this helps. You need to explicitly tell mongodb to listen on non-localhost devices. By default it runs only on localhost.

From http://www.mongodb.org/display/DOCS/Security+and+Authentication:

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.


SOLVED! to anyone who is using EC2 default redhat installation, you need to run this command:

system-config-firewall-tui


With mongoDB server version 3.6.4, Ubuntu 16.4.4 I solved this by setting the net section in /etc/mongod.conf like this:

net:
  port: 27017
  bindIpAll: true
#  bindIp: 127.0.0.1