I am trying to create a remote mongodb server to work with on my java project.
I am using vagrant + ansible to create the environment, but fr soem reson i cannot get a c
Firstly, To ensure its not a firewall issue, stop IPTABLES on both servers (don't forget to re-enable afterwards).
On the machine that you are trying to connect to, ssh directly to it and ensure MongoDB is running, Connect locally and check that you can access a DB.
MongoDb isn't configured to accept connections from remote hosts by default, could you ensure you have these lines in your /etc/mongodb.conf
file:
bind_ip = 0.0.0.0
port = 27017
Make sure you restart MongoDB after making any changes. Try this and comment if your still having issues and I'll update the answer with more suggestions.
EDIT: As of version 2.6 the config file format has changed to YAML, details here, the file should be located at /etc/mongod.conf
.
net:
bindIp: 0.0.0.0
port: 27017