大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
创新互联www.cdcxhl.cn八线动态BGP香港云服务器提供商,新人活动买多久送多久,划算不套路!
创新互联公司坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站建设、网站设计、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的龙江网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!小编给大家分享一下解决linux下启动mongodb出现错误的方法,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨方法吧!
解决linux下启动mongodb出现错误的方法:
根据错误信息进入日志文件根据日志文件具体内容中提供的地址获取到修改方式
删除日志文件,以repair方式启动数据库
然后再启动一次数据库,查看进程,如果数据库进程存在,则修复成功
启动错误:
[root@oracleLinux ~]# service mongod start Starting mongod: Fri Jan 24 09:59:59.385 Fri Jan 24 09:59:59.386 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 09:59:59.387 about to fork child process, waiting until server is ready for connections. forked process: 2120 all output going to: /var/log/mongo/mongod.log ERROR: child process failed, exited with error number 100
日志文件:
ERROR: child process failed, exited with error number 100
日志文件相关内容:
**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Thu Jan 23 12:34:11.293 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Thu Jan 23 12:34:11.293 dbexit:
Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close listening sockets...
Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to flush diaglog...
Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close sockets...
Thu Jan 23 12:34:11.293 [initandlisten] shutdown: waiting for fs preallocator...
Thu Jan 23 12:34:11.293 [initandlisten] shutdown: closing all files...
Thu Jan 23 12:34:11.293 [initandlisten] closeAllFiles() finished
Thu Jan 23 12:34:11.293 dbexit: really exiting now
此处是非法关闭mongodb,根据日子文件具体内容中提供的地址(第3行处)获取到修复方式。
a、首先删除/var/lib/mongo/目录下的mongod.lock文件,具体命令如下:
[root@oracleLinux ~]# rm /var/lib/mongo/mongod.lock
b、已repair方式启动mongodb,具体命令如下:
[root@oracleLinux mongo]# mongod -f /etc/mongod.conf --repair Fri Jan 24 10:38:39.112 Fri Jan 24 10:38:39.113 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 10:38:39.114 about to fork child process, waiting until server is ready for connections. forked process: 2237 all output going to: /var/log/mongo/mongod.log child process started successfully, parent exiting
在启动一次mongodb,具体命令如下:
[root@oracleLinux mongo]# mongod -f /etc/mongod.conf Fri Jan 24 10:41:13.664 Fri Jan 24 10:41:13.665 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Fri Jan 24 10:41:13.666 about to fork child process, waiting until server is ready for connections. forked process: 2253 all output going to: /var/log/mongo/mongod.log child process started successfully, parent exiting
查看进程,如果存在mongodb进程,即代表修复成功,具体命令如下:
[root@oracleLinux mongo]# ps -ef | grep mongo root 2253 1 2 10:41 ? 00:00:02 mongod -f /etc/mongod.conf root 2268 2079 0 10:43 pts/0 00:00:00 grep mongo
看完了这篇文章,相信你对解决linux下启动mongodb出现错误的方法有了一定的了解,想了解更多相关知识,欢迎关注创新互联-成都网站建设公司行业资讯频道,感谢各位的阅读!