Debian 上配置 MongoDB 的网络设置
一 基础网络参数配置
net:
port: 27017
bindIp: 192.168.1.100
net:
port: 27017
bindIp: 127.0.0.1,192.168.1.100
二 防火墙与端口放行
三 远程连接与安全加固
security:
authorization: enabled
mongo
use admin
db.createUser({ user: "admin", pwd: "StrongPass!", roles: ["root"] })
exit
mongo -u admin -p StrongPass! --authenticationDatabase admin
net:
ssl:
mode: requireSSL
PEMKeyFile: /path/to/mongodb.pem
CAFile: /path/to/ca.pem
四 连接测试与排障
五 附录 常用配置片段
net:
port: 27017
bindIp: 127.0.0.1
net:
port: 27017
bindIp: 192.168.1.100
net:
port: 27017
bindIp: 127.0.0.1,192.168.1.100
security:
authorization: enabled
net:
ssl:
mode: requireSSL
PEMKeyFile: /path/to/mongodb.pem
CAFile: /path/to/ca.pem