![如何知道 mongodb 是在 64 位模式还是 32 位模式下运行](https://linux22.com/image/1325546/%E5%A6%82%E4%BD%95%E7%9F%A5%E9%81%93%20mongodb%20%E6%98%AF%E5%9C%A8%2064%20%E4%BD%8D%E6%A8%A1%E5%BC%8F%E8%BF%98%E6%98%AF%2032%20%E4%BD%8D%E6%A8%A1%E5%BC%8F%E4%B8%8B%E8%BF%90%E8%A1%8C.png)
我的程序员安装了 mongodb。然后不知怎么的,它不起作用。我运行
C:\mongod\bin>mongod
mongod --help for help and startup options
Sat Aug 11 22:57:50
Sat Aug 11 22:57:50 warning: 32-bit servers don't have journaling enabled by def
ault. Please use --journal if you want durability.
Sat Aug 11 22:57:50
Sat Aug 11 22:57:50 [initandlisten] MongoDB starting : pid=3800 port=27017 dbpat
h=/data/db 32-bit host=haryantoi5
Sat Aug 11 22:57:50 [initandlisten]
Sat Aug 11 22:57:50 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
limited to about 2 gigabytes of data
Sat Aug 11 22:57:50 [initandlisten] ** see http://blog.mongodb.org/post/13
7788967/32-bit-limitations
Sat Aug 11 22:57:50 [initandlisten] ** with --journal, the limit is lower
Sat Aug 11 22:57:50 [initandlisten]
Sat Aug 11 22:57:50 [initandlisten] db version v2.0.7-rc1, pdfile version 4.5
Sat Aug 11 22:57:50 [initandlisten] git version: 9efe4cce272373b52b96de1309c1fbf
0c984305f
Sat Aug 11 22:57:50 [initandlisten] build info: windows sys.getwindowsversion(ma
jor=6, minor=0, build=6002, platform=2, service_pack='Service Pack 2') BOOST_LIB
_VERSION=1_42
Sat Aug 11 22:57:50 [initandlisten] options: {}
**************
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Sat Aug 11 22:57:50 [initandlisten] exception in initAndListen: 12596 old lock f
ile, terminating
Sat Aug 11 22:57:50 dbexit:
Sat Aug 11 22:57:50 [initandlisten] shutdown: going to close listening sockets..
.
Sat Aug 11 22:57:50 [initandlisten] shutdown: going to flush diaglog...
Sat Aug 11 22:57:50 [initandlisten] shutdown: going to close sockets...
Sat Aug 11 22:57:50 [initandlisten] shutdown: waiting for fs preallocator...
Sat Aug 11 22:57:50 [initandlisten] shutdown: closing all files...
Sat Aug 11 22:57:50 [initandlisten] closeAllFiles() finished
Sat Aug 11 22:57:50 dbexit: really exiting now
看来 mongod 是在 32 位上运行的。我有一台 64 位计算机,我想在 64 位环境中运行 mongodb。我该怎么做?
答案1
您的问题不在于 64 位和 32 位架构之间的差异。这是一个警告,服务器应该继续运行(尽管在 32 位下您的数据限制为 2Gb)。您真正要面对的是以下行:
Unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
*************
Sat Aug 11 22:57:50 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
这意味着数据库被强制关闭,并且尚未自行清理。您需要运行“mongod --repair”来清理陈旧的锁并使数据库恢复正常。
http://www.mongodb.org/display/DOCS/Durability+and+Repair
请注意建议不要删除锁文件的部分。