Unable to connect to mongolab host

Hannan Shaik picture Hannan Shaik · Jul 9, 2014 · Viewed 17.7k times · Source

I am trying to connect to mongolab from terminal via below command

 mongo ds061158.mongolab.com:61158/order_it -u <dbuser> -p <dbpassword>

I am getting the below error.

MongoDB shell version: 2.6.3
connecting to: ds061158.mongolab.com:61158/order_it
2014-07-09T13:52:44.890+0530 Error: couldn't connect to server ds061158.mongolab.com:61158 (23.22.170.205), connection attempt failed at src/mongo/shell/mongo.js:148
exception: connect failed

What has to be done in this case?

Thanks in Advance.

Answer

jared picture jared · Jul 9, 2014

It looks like your network is blocking access to that port. I'd recommend contacting your network administrator or trying from a different network.

To test your network connectivity alone (no credentials necessary) you can run this command. This example was run from my unprivileged laptop just now and demonstrates a successful test.

% mongo ds061158.mongolab.com:61158
MongoDB shell version: 2.6.1
connecting to: ds061158.mongolab.com:61158/test
rs-ds061158:PRIMARY> db.runCommand({ping:1});
{ "ok" : 1 }
rs-ds061158:PRIMARY> exit
bye

Our full connectivity troubleshooting guide is here: http://docs.mongolab.com/connecting/#help

Also, feel free to contact us as [email protected] if you'd like us to dig into the specifics of your server or code. We're always happy to help!

Regards,

Jared