当我尝试在命令行上使用命令“mongod.exe”启动mongodb时,它会抛出以下错误..
C:\mongodb-win32-x86_64-2.0.6\bin>mongod.exe
mongod.exe --help for help and startup options
Thu Aug 09 11:56:48 [initandlisten] MongoDB starting : pid=6892 port=27017 dbpat
h=/data/db 64-bit host=user4-PC
Thu Aug 09 11:56:48 [initandlisten] db version v2.0.6, pdfile version 4.5
Thu Aug 09 11:56:48 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7b
b49fb05bc
Thu Aug 09 11:56:48 [initandlisten] build info: windows sys.getwindowsversion(ma
jor=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB
_VERSION=1_42
Thu Aug 09 11:56:48 [initandlisten] options: {}
**************
old lock file: \data\db\mongod.lock. probably means unclean shutdown,
but there are no journal files to recover.
this is likely human error or filesystem corruption.
found 3 dbs.
see: http://dochub.mongodb.org/core/repair for more information
*************
Thu Aug 09 11:56:48 [initandlisten] exception in initAndListen: 12596 old lock f
ile, terminating
Thu Aug 09 11:56:48 dbexit:
Thu Aug 09 11:56:48 [initandlisten] shutdown: going to close listening sockets..
.
Thu Aug 09 11:56:48 [initandlisten] shutdown: going to flush diaglog...
Thu Aug 09 11:56:48 [initandlisten] shutdown: going to close sockets...
Thu Aug 09 11:56:48 [initandlisten] shutdown: waiting for fs preallocator...
Thu Aug 09 11:56:48 [initandlisten] shutdown: lock for final commit...
Thu Aug 09 11:56:48 [initandlisten] shutdown: final commit...
Thu Aug 09 11:56:48 [initandlisten] shutdown: closing all files...
Thu Aug 09 11:56:48 [initandlisten] closeAllFiles() finished
Thu Aug 09 11:56:48 dbexit: really exiting now
我真的无法启动mongodb ..帮我启动mongodb作为Windows服务并纠正错误。我已经阅读了安装指南并按照相同的方法但仍然抛出错误。
答案 0 :(得分:40)
删除锁定文件\data\db\mongod.lock
,然后运行mongod --repair
。
答案 1 :(得分:2)
如果删除锁定文件,您肯定希望运行修复。如果您使用日记功能运行mongodb,则不必修复。有关这两者的更多信息,请访问http://www.mongodb.org/display/DOCS/Durability+and+Repair
答案 2 :(得分:1)
<强>错误修正强> 如果删除 mongodb.lock 文件没有帮助,请尝试使用 - repair
命令修复MongoDB启动MongoDB即服务 如果要将MongoDB作为服务启动,可以添加命令 - service 。如果您有多个实例,那么cou也可以使用 - serviceName {name} 和 - serviceDisplayName {name} 来获取uniqe名称。您可以找到有关作为服务启动的更多信息here