2012-08-09 132 views
11

當我試圖啓動MongoDB的使用命令行命令「mongod.exe」,它引發以下錯誤..mongodb無法在Windows上啓動?

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

remove \ data \ db \ mongod.lock文件中重試。 – 2012-08-09 06:35:13

+0

仍然沒有工作..它掛了這個.. Thu Aug 09 12:11:43 [clientcursormon] mem(MB)res:20 virt:79 mapped:0 – user1578749 2012-08-09 06:41:52

+0

一個適當的解決方案可以在http:// stackoverflow.com/questions/13700261/mongodb-wont-start-after-server-crash – Jinex2014 2015-03-25 10:50:54

回答

37

刪除鎖定文件\data\db\mongod.lock,並運行mongod --repair

source

+0

其中是Windows上的文件? – guiomie 2013-09-07 01:55:55

+0

在Windows上,我只需要運行mongod --repair – 2013-11-20 07:14:57

+0

請注意,在大型數據庫上執行此操作可能需要數小時,並且需要足夠的磁盤空間來存放整個數據庫的另一個副本。如果你正在使用日誌,你也不需要它。 http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/ – tjrobinson 2013-11-22 09:51:48

1

修正錯誤 如果鴕鳥政策幫助刪除mongodb.lock文件,嘗試修復的MongoDB用命令--repair

開始的MongoDB作爲服務 如果您想啓動MongoDB作爲服務,您可以添加命令- 服務。如果您有多個實例,cou可以使用--serviceName {name}--serviceDisplayName {name}以獲取唯一名稱。你可以找到here關於作爲服務啓動的更多信息