MongoDB won't start when I use multiple ip adresses

2,423 views
Skip to first unread message

Jeroen van Barneveld

unread,
Jun 16, 2016, 4:35:49 PM6/16/16
to mongodb-user
Can someone please help me with the following problem: http://stackoverflow.com/q/37857270/4735131 ??

Would be awesome because I really need to have this fixed...

Thanks in advance!

Kevin Adistambha

unread,
Jun 29, 2016, 10:55:14 PM6/29/16
to mongodb-user

Hi Jeroen,

Can someone please help me with the following problem: http://stackoverflow.com/q/37857270/4735131 ??

I can replicate the error message you saw if I tried to bind to an IP address that is not my machine’s. For example, my machine’s IP address is 10.0.2.15. If I try to intentionally bind to a wrong address:

2016-06-30T12:44:31.387+1000 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { bindIp: "127.0.0.1,10.0.2.10" }, storage: { dbPath: "." } }
2016-06-30T12:44:31.408+1000 E NETWORK  [initandlisten] listen(): bind() failed errno:99 Cannot assign requested address for socket: 10.0.2.10:27017
2016-06-30T12:44:31.408+1000 E STORAGE  [initandlisten] Failed to set up sockets during startup.
2016-06-30T12:44:31.409+1000 I CONTROL  [initandlisten] dbexit:  rc: 48

Which is identical to the error message you posted. However using the correct IP address works as expected:

2016-06-30T12:44:17.158+1000 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { bindIp: "127.0.0.1,10.0.2.15" }, storage: { dbPath: "." } }
(...)
2016-06-30T12:44:17.256+1000 I NETWORK  [initandlisten] waiting for connections on port 27017

Are you absolutely certain that 192.168.2.1 is your machine’s IP address? You can check by running the command ifconfig | grep inet, e.g.:

$ ifconfig | grep inet
inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe09:d1cc/64 Scope:Link
inet addr:127.0.0.1  Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host

Please note that the bindIp configuration for multiple address requires them to be comma separated values.

If you are still having issues, could you post:

  • your O/S version
  • the contents of your mongod.conf config file (should be /etc/mongod.conf in your case)
  • how did you install MongoDB, and from where

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages