不多说,直接上干货!
前期博客
Ubuntu14.04下Mongodb安装部署步骤(图文详解)
Ubuntu16.04下Mongodb安装部署步骤(图文详解)
root@zhouls-virtual-machine:/usr/local/mongodb/bin# ls bsondump mongodump mongoimport mongoreplay mongostat mongo mongoexport mongooplog mongorestore mongotop mongod mongofiles mongoperf mongos root@zhouls-virtual-machine:/usr/local/mongodb/bin# ./mongod --dbpath=/usr/local/mongodb/data/ --fork --logpath=/usr/local/mongodb/log about to fork child process, waiting until server is ready for connections. forked process: 5784 ERROR: child process failed, exited with error number 1 root@zhouls-virtual-machine:/usr/local/mongodb/bin#
失败的原因
是因为通过service MongoDB restart时启动失败,或者如果是直接kill 掉来关闭都会出现这种情况
是因为没有正常关闭导致的。
是因为你的配置目录,是否应该要是log配置文件,而很多人都写成了log目录。
解决办法
zhouls@zhouls-virtual-machine:~$ sudo ufw disable [sudo] password for zhouls: Firewall stopped and disabled on system startup zhouls@zhouls-virtual-machine:~$
root@zhouls-virtual-machine:/usr/local/mongodb# ls bin data GNU-AGPL-3.0 log MPL-2 README THIRD-PARTY-NOTICES root@zhouls-virtual-machine:/usr/local/mongodb# rm -rf log/ root@zhouls-virtual-machine:/usr/local/mongodb# ls bin data GNU-AGPL-3.0 MPL-2 README THIRD-PARTY-NOTICES root@zhouls-virtual-machine:/usr/local/mongodb# touch log root@zhouls-virtual-machine:/usr/local/mongodb# cd bin root@zhouls-virtual-machine:/usr/local/mongodb/bin# pwd /usr/local/mongodb/bin root@zhouls-virtual-machine:/usr/local/mongodb/bin# ls bsondump mongodump mongoimport mongoreplay mongostat mongo mongoexport mongooplog mongorestore mongotop mongod mongofiles mongoperf mongos root@zhouls-virtual-machine:/usr/local/mongodb/bin# ./mongod --dbpath=/usr/local/mongodb/data/ --fork --logpath=/usr/local/mongodb/log about to fork child process, waiting until server is ready for connections. forked process: 6072 child process started successfully, parent exiting root@zhouls-virtual-machine:/usr/local/mongodb/bin#