I'm running ubuntu 14.04 and am unable to connect to any remote mongodb server on my home network. I'm pretty sure it worked only a month ago. Furthermore, I have no problems connecting from my work network.

For example, I have an aws server running mongodb. I can ssh to it, but trying to connect with mongo results in the uniform connection error ("couldn't connect to server... connection attempt failed").

Any suggestions on how I can troubleshoot this?

EDIT: I just confirmed the same behavior on a windows machine. Could it have to do with my ISP?

EDIT 2: turns out it was a problem with the router. I'd still be interested to know of there's any way to identify where the issue is from the computer, without going to the router. Though even if I had looked at the router I wouldn't have known that it was blocking all non-standard ports.


Check if your mongo instance is running, by doing

sudo service mongod status

If your mongo is not running, then you can either write:

sudo service mongod start


if you have conf setup with auth, then write:

mongod --auth --configure /usr/local/etc/mongod.conf
  • I don't understand how the answer is related to the question. I'm not trying to connect to a local mongod server. I'm trying to connect to remote hosted mongo instances. – joniba Jan 8 '16 at 14:49
  • This is just a heads up whether you're connected to mongodb or not. 2nd step will be to check if you've authorised access or not, and last wuld be to check mongodb error log file. – Gaurav Dave Jan 9 '16 at 17:20

Well, my understanding is that you are trying to access the mongodb server you set up at home from other environment, and you failed. My suggestion is that if you can access your mongodb server at home, and you cannot access it from your AWS server or windows laptop, it should be a network problem, most likely a firewall? Do you have firewall within your OS? If not, maybe you can ask your ISP about it~

  • Yeah I have no firewalls set up. I'm sure it had to do with my home network. But the problem persisted for 2 days and then disappeared without me doing anything. So I honestly have no clue. I had no problem accessing local mongodb at home either. – joniba Jan 14 '16 at 14:16
  • So it seems to be a network problem, though it's hard to locate the problem now :P Just hope you are not hacked lol – johniezz Jan 18 '16 at 6:11
  • Hm well it came back the next day. Turns out my router's time had come. Had to go get it replaced. – joniba Jan 18 '16 at 13:26
  • hah good to know~ – johniezz Jan 29 '16 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.