Error while connecting the dev machine to the mongodb remote server

33 views
Skip to first unread message

Soorya Prakash

unread,
Jul 7, 2015, 7:15:36 AM7/7/15
to mongod...@googlegroups.com
Hi,
 I am running the node js sever in dev machine connecting the mongodb installed in another machine. While connecting mongo db i am getting error like Error: failed to connect to [ip address:27017].But when i tested using ping i can able to receive packets.I don't know what will be the problem failing to connect.

borgy 95

unread,
Jul 7, 2015, 8:13:02 AM7/7/15
to mongod...@googlegroups.com
Have you checked the firewall? is the ip/port/protocol whitelisted? 

borgy95

Soorya Prakash

unread,
Jul 7, 2015, 8:14:12 AM7/7/15
to mongod...@googlegroups.com
Hi,
 I am running the node js sever in dev machine connecting the mongodb installed in another machine. While connecting mongo db i am getting error like Error: failed to connect to [ip address:27017].But when i tested using ping ip address  i can able to receive packets.I also tried with same configuration from another dev machine and i can able to connect successfully.What can be a problem not working with particular system not connecting mongo db while the  same configuration working with another machine?

Soorya Prakash

unread,
Jul 7, 2015, 8:19:46 AM7/7/15
to mongod...@googlegroups.com
Sorry I am new to the network configuration , can you please tell me how can I check the firewall settings? From server side machine or mongo db machine?

borgy 95

unread,
Jul 7, 2015, 8:49:30 AM7/7/15
to mongod...@googlegroups.com
If this was an authentication issue it would say it in the error. I can only tell you how to check your firewall conf if i know the OS you are using. 

You need to check the inbound firewall rules on the server with mongodb, aka the server you are connecting to.  If it is a systemd based OS (e.g RHEL/Centos) do a firewall-cmd --list-all-zones otherwise use iptables -L (i think, been a while since i used iptables)

Soorya Prakash

unread,
Jul 7, 2015, 8:57:10 AM7/7/15
to mongod...@googlegroups.com
I was using the ubuntu 14.04 system. I checked by running the ufw status command.Then I added the machine ip using "ufw allow from ip address" command.Now its working fine. Thanks borgy.
Reply all
Reply to author
Forward
0 new messages