I really tried, even reinstall the MongoDB.
And it\'s the same to MongoDB bind_ip error: bind() failed errno:99 Cannot assign requested address for socket
It
This is a notation that only works on Ubuntu: (watch out on spaces, symbols)
bind_ip=[127.0.0.1,22.33.44.99,88.77.55.66]
22.33.44.99 - my static ip of server, 88.77.55.66 - my static ip of laptop. That gave me an opportunity to access to mongodb out from internet. Don't forget to add a rule - open port 27017 to ufw.
Using MongoDB 4.0.5: For me the following worked:
bindIp=[127.0.0.1,11.22.33.44]
And then I switched on Auth:
security:
authorization: "enabled"
Restarting mongod (on Ubuntu 18.04) gave an error:
Scalar option 'net.bindIp' must be a single value
Therefore I had to do the bindIp: 0.0.0.0. Maybe somebody has a clue how to combine bindIp and Security
I had the same issue just because of the silly mistake.
There was commented line and space problem.
What I did wrong
# network interfaces
net:
port: 27017
#bindIp: 127.0.0.1
bindIp: privateIp
instead of
net:
port: 27017
bindIp: 10.1.2.4
for bind to multiples ips
bindIp: [127.0.0.1,10.128.0.2]
hopefully this answer helpful for someone.
In my case, none of the options above worked. The specification that finally worked for me was:
bind_ip= [<IP_one> <IP_two>]
An example could be:
bind_ip= [127.0.0.1 10.0.0.4]
(Notice that there is no comma between the two directions)
I have MongoDB 2.6.10 on Ubuntu 16.4.5 (LTS)
Edit: I do not know wether I was simply wrong with my answer or if the behavior of bind_ip
was changed, but it is possible to bind to multiple, distinct IPs
bind_ip:127.0.0.1,10.0.0.1,8.8.8.8
So, most likely, one of the IP addresses mongod was assigned to bind to did not exist on the machine in question.
You can bind mongod
only to one IP, with 0.0.0.0
being the alias for "listen on all available network interfaces".
So either use
bind_ip=127.0.0.1
to listen to the loop back interface or
bind_ip=<someIP>
to listen to that IP only or
bind_ip=0.0.0.0
to listen to all available IPs on the system.
If you need to listen to several specific IPs, it is very likely that your system design is somehow screwed.
Hey I am using MongoDB shell version: 3.2.6 .
bindIP = 127.0.0.1,192.168.0.50
bindIP = [127.0.0.1,192.168.0.50]
bind_ip = 192.168.6.38
not working , i have edited mongod.conf using this command
sudo -i gedit /etc/mongod.conf file
And Changed bind_ip = 0.0.0.0 to bind_ip = 192.168.6.38 it working fine ....