每次启动MongoDB时总是会收到如下 Unclean shutdown 提示,总结了一下出现该问题的原因及解决方法。
提示如下:
************** D:\GREENT~1\PowerCmd>mongod --auth -dbpath C:\mongo\MongoDB\mongo\data Wed May 16 16:06:50 Wed May 16 16:06:50 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Wed May 16 16:06:50 Wed May 16 16:06:50 [initandlisten] MongoDB starting : pid=5016 port=27017 dbpath=C:\mongo\MongoDB\mongo\data 32-bit host=mxh Wed May 16 16:06:50 [initandlisten] Wed May 16 16:06:50 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data Wed May 16 16:06:50 [initandlisten] ** see http://blog.mongodb.org/post/137788967/32-bit-limitations Wed May 16 16:06:50 [initandlisten] ** with --journal, the limit is lower Wed May 16 16:06:50 [initandlisten] Wed May 16 16:06:50 [initandlisten] db version v2.0.1, pdfile version 4.5 Wed May 16 16:06:50 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684 Wed May 16 16:06:50 [initandlisten] build info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_42 Wed May 16 16:06:50 [initandlisten] options: { auth: true, dbpath: "C:\mongo\MongoDB\mongo\data" } ************** Unclean shutdown detected. Please visit http://dochub.mongodb.org/core/repair for recovery instructions. ************* Wed May 16 16:06:51 [initandlisten] exception in initAndListen: 12596 old lock file, terminating Wed May 16 16:06:51 dbexit: Wed May 16 16:06:51 [initandlisten] shutdown: going to close listening sockets... Wed May 16 16:06:51 [initandlisten] shutdown: going to flush diaglog... Wed May 16 16:06:51 [initandlisten] shutdown: going to close sockets... Wed May 16 16:06:51 [initandlisten] shutdown: waiting for fs preallocator... Wed May 16 16:06:51 [initandlisten] shutdown: closing all files... Wed May 16 16:06:51 [initandlisten] closeAllFiles() finished Wed May 16 16:06:51 dbexit: really exiting now
经过多次测试发现,造成这种情况的原因是我使用PowerCMD启动MongoDB之后直接关掉PowerCMD窗口之后造成的,如果在关闭PowerCMD窗口之前使用 [ctrl + c] 快捷键终止mongod的运行也不会出现此种情况。而且,使用普通的CMD窗口运行mongo命令即使直接关掉窗口也不会出现该问题,看来还是使用原生程序更靠谱。
发生了此种情况解决方法也很简单,使用如下参数repair即可:
mongod --auth -dbpath C:\mongo\MongoDB\mongo\data --repair
然后重新启动即可:
D:\GREENT~1\PowerCmd>mongod --auth -dbpath C:\mongo\MongoDB\mongo\data Wed May 16 16:44:35 Wed May 16 16:44:35 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability. Wed May 16 16:44:35 Wed May 16 16:44:35 [initandlisten] MongoDB starting : pid=9616 port=27017 dbpath=C:\mongo\MongoDB\mongo\data 32-bit host=mxh Wed May 16 16:44:35 [initandlisten] Wed May 16 16:44:35 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data Wed May 16 16:44:35 [initandlisten] ** see html" target="_blank">http://blog.mongodb.org/post/137788967/32-bit-limitations Wed May 16 16:44:35 [initandlisten] ** with --journal, the limit is lower Wed May 16 16:44:35 [initandlisten] Wed May 16 16:44:35 [initandlisten] db version v2.0.1, pdfile version 4.5 Wed May 16 16:44:35 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684 Wed May 16 16:44:35 [initandlisten] build info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_42 Wed May 16 16:44:35 [initandlisten] options: { auth: true, dbpath: "C:\mongo\MongoDB\mongo\data" } Wed May 16 16:44:35 [initandlisten] waiting for connections on port 27017 Wed May 16 16:44:35 [websvr] admin web console waiting for connections on port 28017
还有一些情况会造成这种 Unclean shutdown,解决方法可参考官方文档:
http://www.mongodb.org/display/DOCS/Durability+and+Repair
本文向大家介绍MongoDb的"not master and slaveok=false"错误及解决方法,包括了MongoDb的"not master and slaveok=false"错误及解决方法的使用技巧和注意事项,需要的朋友参考一下 使用mongodb时,出现“not master and slaveok=false”错误,原因是secondary不允许读写。 因为系统中mongodb做
问题内容: 我正在将JTOpen JDBC驱动程序用于DB2通用数据库。除了简单的语句,我对SQL的经验很少。 从这个问题中,我看到尝试“在事务期间插入/更新非日记表中的行”时,抛出了我正在获取的错误(SQL7008)。 根据项目负责人的说法,我们的数据库未记录在日志中,因此不会很快出现(不要问我为什么,我不是DBA)。但是,我正在一个项目中,几乎一劳永逸(而不是每次调用一次执行都会自动提交)的功
本文向大家介绍Python提示[Errno 32]Broken pipe导致线程crash错误解决方法,包括了Python提示[Errno 32]Broken pipe导致线程crash错误解决方法的使用技巧和注意事项,需要的朋友参考一下 本文实例讲述了Python提示[Errno 32]Broken pipe导致线程crash错误解决方法。分享给大家供大家参考。具体方法如下: 1. 错误现象 T
本文向大家介绍PHP错误Warning:mysql_query()解决方法,包括了PHP错误Warning:mysql_query()解决方法的使用技巧和注意事项,需要的朋友参考一下 php提示错误:Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using pass
本文向大家介绍MySQL错误ERROR 1615 解决方法,包括了MySQL错误ERROR 1615 解决方法的使用技巧和注意事项,需要的朋友参考一下 今天测试合服脚本的时候,遇到一个很奇怪的问题。Mysql报ERROR: ERROR 1615 (HY000): Prepared statement needs to be re-prepared 经过测试,发现不是合服脚本的问题。经过一番搜索。发
本文向大家介绍ioncube_loader_win_5.2.dll的错误解决方法,包括了ioncube_loader_win_5.2.dll的错误解决方法的使用技巧和注意事项,需要的朋友参考一下 我们做项目的时候遇到了出现下边这些错误 requires the ionCube PHP Loader ioncube_loader_win_5.2.dll to be installed by the