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 works if set bind_ip to: 0.0.0.0, or 127.0.0.1
$ sudo service mongod start
mongod start/running, process 30040
$ sudo service mongod restart
mongod stop/waiting
mongod start/running, process 29704
$ mongo --port 19708
MongoDB shell version: 3.0.3
connecting to: 127.0.0.1:19708/test
>
It won't work if set bing_ip
to: 127.0.0.1,192.118.96.10,42.112.36.110
$ sudo service mongod start
mongod start/running, process 29969
$ sudo service mongod restart
stop: Unknown instance:
mongod start/running, process 29766
$ mongo --port 19708
MongoDB shell version: 3.0.3
connecting to: 127.0.0.1:19708/test
2015-06-17T06:32:34.625+0000 W NETWORK Failed to connect to 127.0.0.1:19708
reason: errno:111 Connection refused
2015-06-17T06:32:34.627+0000 E QUERY
Error: couldn't connect to server 127.0.0.1:19708 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed
locations:
$ which mongod
/usr/bin/mongod
$ which mongo
/usr/bin/mongo
configurations in /etc/mongod.conf
dbpath=/var/lib/mongodb
logpath=/var/log/mongodb/mongod.log
logappend=true
port = 19708
# ips, eg:
# private ip for mongodb server: 192.118.96.10
# public ip for remote app server: 42.112.36.110
bind_ip = 127.0.0.1,192.118.96.10,42.112.36.110
auth = true
Thanks in advance.
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.