当你在linux系统配置好存储数据和日志 的目录后新建并修改配置文件 :
systemLog:
destination: file
path: "/softwareInstall/mongoDB/log/mongod.log"
logAppend: true
storage:
dbPath: "/softwareInstall/mongoDB/data/db"
journal:
enabled: true
processManagement:
fork: true
net:
bindIp: localhost,139.196.222.221
port: 27017
之后执行启动程序:
/softwareInstall/mongoDB/bin/mongod -f /softwareInstall/mongoDB/mongod.conf
程序报错:
about to fork child process, waiting until server is ready for connections. forked process: 16341 ERROR: child process failed, exited with error number 48 To see additional information in this output,
可能的原因:你把服务器的公网IP复制到了配置文件的bindIp上面,通过ifconfig命令查看服务器的ip,可以看到ip为:
然后将配置文件的 bindIp: localhost,139.196.222.221修改为 bindIp: localhost,172.18.0.1后,再重新启动MongoDB,可以看到启动成功: