我希望允许特定的IP地址与我在服务器中的mongoDB合并。为此,我打开了mongod.conf并进行了如下编辑:
net :
port: 27017
bindIp: localhost,<IpAdres>
security:
authorization: enable我尝试了授权'enable',但唯一有效的等待是作为初始配置:
net :
port: 27017
bindIp: localhost
#security:
# authorization: enable如果我把
net :
port: 27017, <IpAdress>
bindIp: localhost
#security:
# authorization: enable我得到的错误是:
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
我的目标是只允许一组特定的IP地址与我的服务器上的mongo连接在一起。
版本: 4.0.18运行在RedHat 7.8上
netstat看起来像这样
Proto | Recv-Q |Send-Q | Local Address | Foreign Address | State | PID/Program name
tcp | 0 | 0 |127.0.0.1:27017 | 0.0.0.0:* | LISTEN | -
发布于 2020-05-18 20:26:18
不需要启用身份验证:
net:
port: 27017
bindIp: localhost, <YOUR_IP>这是正确的,可能您有另一个通信问题,检查您的ip/端口允许通信。
命令'netstat -tulnp‘可以帮助您。
https://docs.mongodb.com/manual/reference/configuration-options/
无论如何,错误可能是由其他第三个原因引起的,转到/run/mongodb文件夹并删除名为mongod.pid的文件。然后尝试使用以下方法重新启动芒果:
sudo service mongod restart https://stackoverflow.com/questions/61877600
复制相似问题