我试图绑定到我的公共IP。但是在编辑
nano /etc/mongod.conf
它不起作用。现在我想这可能是问题所在。跑步
ifconfig
只显示我的私人ip地址:
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.0.7 netmask 255.255.255.0 broadcast 10.0.0.255
现在,如果我想从网络外部访问这个数据库,我肯定不想绑定到这个私有ip地址,那么我该如何使用我的公共ip地址呢?
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,public_ip_here
尝试使用此配置重新启动服务时,出现以下错误消息:
â mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-06-15 19:04:21 EDT; 1s ago
Docs: https:
Process: 4616 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 4616 (code=exited, status=48)
Jun 15 19:04:21 server systemd[1]: Started High-performance, schema-free document-oriented database.
Jun 15 19:04:21 server systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Jun 15 19:04:21 server systemd[1]: mongod.service: Failed with result 'exit-code'.
我认为这个问题必须围绕这样一个事实:在执行
命令
命令。不过,我并不完全确定。我正在使用我的一个旧的桌面塔,上面有ubuntu来托管mongodb实例,另外还有正在连接的internet连接。感谢所有提前回复的人。