2011-08-16 140 views
2

我試圖啓動蒙戈分貝,但我得到一個錯誤 這裏是輸出:無法啓動蒙戈DB

k-ps-macbook:~ kp$ mongod 
mongod --help for help and startup options 
Tue Aug 16 15:57:11 [initandlisten] MongoDB starting : pid=4143 port=27017 dbpath=/data/db/ 64-bit 
Tue Aug 16 15:57:11 [initandlisten] db version v1.8.2, pdfile version 4.5 
Tue Aug 16 15:57:11 [initandlisten] git version: 433bbaa14aaba6860da15bd4de8edf600f56501b 
Tue Aug 16 15:57:11 [initandlisten] build sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40 
Tue Aug 16 15:57:11 [initandlisten] couldn't open /data/db/awesome_blog.ns errno:13 Permission denied 
Tue Aug 16 15:57:11 [initandlisten] error couldn't open file /data/db/awesome_blog.ns terminating 
Tue Aug 16 15:57:11 dbexit: 
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close listening sockets... 
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to flush diaglog... 
Tue Aug 16 15:57:11 [initandlisten] shutdown: going to close sockets... 
Tue Aug 16 15:57:11 [initandlisten] shutdown: waiting for fs preallocator... 
Tue Aug 16 15:57:11 [initandlisten] shutdown: closing all files... 
Tue Aug 16 15:57:11 closeAllFiles() finished 
Tue Aug 16 15:57:11 [initandlisten] shutdown: removing fs lock... 
Tue Aug 16 15:57:11 dbexit: really exiting now 

任何幫助將不勝感激, 謝謝!

回答

4

你需要讀/寫權限/數據/ DB/

0

我刪除/data/db/mongod.lock來解決這個問題。

1

錯誤顯示,因爲您沒有以root用戶身份登錄。要做到這一點(如果你使用Debian),運行:

sudo mongod 

或者乾脆:

su root 

然後鍵入密碼,然後鍵入

mongod 

然後你會得到的 訪問/ data/db目錄。

0

在命令行中運行:

  1. CD〜
  2. ./mongod --repair

如果您仍然無法得到它運行,然後找到/數據目錄(它應該在〜或〜/工作區內)並將其放入CD中。一旦進入,運行rm mongod.lock然後回到〜再次運行./mongod(見下文)。

  1. CD〜/數據
  2. RM mongod.lock
  3. CD
  4. ./mongod