Reputation: 664
I am trying to setup my MongoDB dev environment using Azure VM. The VM is up and running MongoDB 2.6.6, and I can SSH to the VM and run MongoDB just fine..
However, I am unable to connect to Mongo from any external client (i.e. cmd shell mongo client, or robomongo). I'm using the public IP given to me, and using the default port. I've also tried to edit the /etc/mongodb.conf to specify the port number (port=27017), and have restarted the service.. but that didn't seem to make a difference at all..
Upvotes: 3
Views: 6067
Reputation: 71030
I'm assuming this will be moved to ServerFault. In the meantime: There are two things required for external access, if you just spun up a new MongoDB instance:
mongod.conf
, the default configuration for bind_ip
is 127.0.0.1
, which means mongod
is bound to the local interface. Comment out this line to listen on all interfacesUpvotes: 7
Reputation: 326
The port that mongodb uses is not open for external access. One way you can access it from the client is to open ssh tunnel. Default port for mongodb is 27017: ssh -f -L 27017::27017
Read more on ssh tunneling here: http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
Upvotes: 2