在CentOS上尝试着安装MongoDB,单实例的安装。竟然也碰到一些奇奇怪怪的错误。
1 首先,MongoDB官方文档的repo例子中指向错误了。需要点进去文档中提供的最新的repo路径。我用3.4版本
baseurl = https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/3.4/x86_64
2 在指定Log的时候,一定是指向一个文件,而不是一个文件夹路径
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /MongoDB/Log/Mongodb.log
#上面Path应该以一个具体的文件结尾,而不是/MongoDB/Log
# Where and how to store data.
storage:
dbPath: /MongoDB/Data/
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
如果Log指向一个文件夹,会有如下错误:
about to fork child process, waiting until server is ready for connections.
forked process: 4095
ERROR: child process failed, exited with error number 1