MongoDB bind_ip won't work unless set to 0.0.0.0

后端 未结 12 835
遇见更好的自我
遇见更好的自我 2020-12-04 23:43

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

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 00:27

    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=
    

    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.

提交回复
热议问题