首页 > 解决方案 > 在 mongoDb 4.xx 中绑定多个 IP

问题描述

对于 mongoDB 4.0.3,无法在 bindIp 中添加多个 ip

以下配置适用于本地主机

net:
   port:27017
   bindIp:127.0.0.1

以下适用于从其他 ip 登录:

net:
       port:27017
       bindIp:0.0.0.0

以下不起作用

   bindIp:127.0.0.1 10.0.0.10
   bindIp:127.0.0.1,10.0.0.10
   bindIp:"127.0.0.1,10.0.0.10"
   bindIp:"127.0.0.1 10.0.0.10"
   bindIp:[127.0.0.1,10.0.0.10]
   bindIp:[127.0.0.1, 10.0.0.10]

0.0.0.0 或 127.0.0.1 以外的任何 ip 都会导致 bindIP 出错

如果我尝试以下:

bindIp:10.0.0.10
ERROR: child process failed, exited with error number 48

这个MongoDB Doc没有帮助

任何帮助将不胜感激。

标签: mongodbconfiguration-filesmongodb4.0

解决方案


利用 ; 我在 Mongo 4.2.2 版本中使用

 net:
   port: 27017
   bindIp: 127.0.0.1;10.0.1.149

推荐阅读