2017-02-27 242 views
-1

試過看這個,但只能找到類似的問題,但不一樣。當我嘗試從終端使用'mongod'命令啓動mongodb時,我得到以下內容:Mongo立即關閉

2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] MongoDB starting : pid=861 port=27017 dbpath=/data/db 64-bit host=Dylans-MacBook-Pro-2.local 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] db version v3.4.2 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2k 26 Jan 2017 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] allocator: system 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] modules: none 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] build environment: 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten]  distarch: x86_64 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten]  target_arch: x86_64 
2017-02-27T15:48:17.874+0000 I CONTROL [initandlisten] options: {} 
2017-02-27T15:48:17.875+0000 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating 
2017-02-27T15:48:17.875+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets... 
2017-02-27T15:48:17.875+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog... 
2017-02-27T15:48:17.875+0000 I CONTROL [initandlisten] now exiting 
2017-02-27T15:48:17.875+0000 I CONTROL [initandlisten] shutting down with code:100 

任何想法?謝謝! (使用Mac OS 10.12)

回答

3

試圖創建一個只讀的目錄鎖定文件:/數據/ DB

基本上你需要確保/數據/ db目錄是可寫的。您可能手動創建了它,而無需寫入權限。