首页 > 解决方案 > Mongodb绑定多个ip

问题描述

我正在为 ubuntu 使用 mongodb v4.2.3,我正在尝试绑定 localhost 和我的公共 ip,但是每次我在编辑配置文件后重新加载 mongodb 时都会出错。

bind_ip = 127.0.0.1
port = 27017

重新启动mongodb时的错误:

Job for mongodb.service failed because the control process exited with error code.
See "systemctl status mongodb.service" and "journalctl -xe" for details.

标签: javascriptnode.jsmongodb

解决方案


解决了。

bind_ip = 127.0.0.1

对于单个ip,因为它被解释为数字

bind_ip = "127.0.0.1,xxx.xxx.xxx.xxx"

对于多个ip,因为它被解释为字符串


推荐阅读