新增配置文件
mongodb.conf
port=27017 #端口
dbpath=/data/mongodb #数据存储目录
logpath=/usr/local/mongodb/log/mongodb.log #日志存储位置
logappend=true
fork=true #常驻进程
启动
./bin/mongod -f mongodb.conf
报错处理
mongodb]# ./bin/mongod -f mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 19590
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
发现是配置的log文件夹没有创建,创建log文件夹后重新执行正常启动
mongodb]# ./bin/mongod -f mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 19622
child process started successfully, parent exiting
网友评论