I have installed mongo on machine1(Ubuntu 14.04.3 LTS server
) in my local network. I have also opened the port 27017
as mentioned in this guide using f
Make sure you have a daemon running on your machine1 which listen to port 27017. We were getting the same error and found that daemon was not running.
I have tried a different way to solve this issue. I have changed the config file from
bind_ip = 127.0.0.1
#port = 27017
to
bind_ip = 0.0.0.0
#port = 27017
Hope it helps. Happy coding ;)
The issue was bindIp
didn't change. There was some issue in restarting mongo from my side.
The habit should be to verify if the bindIp actually changed or not. (using sudo netstat -tulpn | grep 27017
)
make sure that mongodb daemon is running, and listening on 0.0.0.0, but not 127.0.0.1 port
for example, for my local mongodb, it has this config:
[vodolaz095@steel ~]$ cat /etc/mongod.conf
##
### Basic Defaults
##
# Comma separated list of ip addresses to listen on (all local ips by default)
bind_ip = 127.0.0.1
# Specify port number (27017 by default)
#port = 27017
for mongodb server to listen for remote connections, you can change
# Comma separated list of ip addresses to listen on (all local ips by default)
bind_ip = 0.0.0.0
With mongoDB server version 3.6.4, Ubuntu 16.4.4 I solved this by setting the net section in /etc/mongod.conf like this:
net:
port: 27017
bindIpAll: true
# bindIp: 127.0.0.1