MongoDB错误32-bitserversdon'thavejournalingenabledbydefault如何解决方法

在希望的田野上,我们看到了希望,看到了未来,看到了祖国未来繁荣昌盛的景象。

每次启动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 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错误32-bitserversdon'thavejournalingenabledbydefault如何解决方法就介绍到这了。行走在路上,总会遇见蛋挞鸡翅烤串奶茶煎饼果子章鱼小丸子,再痛,也会过去,总有天放晴的那一天。更多相关MongoDB错误32-bitserversdon'thavejournalingenabledbydefault如何解决方法内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!

您可能有感兴趣的文章
mongos崩溃后无法重启问题的如何解决方法

MongoDB游标超时问题的4种如何解决方法

MongoDB磁盘IO问题的3种如何解决方法

MongoDB最大连接数设置失效的异常分析过程与如何解决方法

MongoDB诡异问题之sh.stopBalancer卡住的如何解决方法