1. 程式人生 > >mongoDB: shutting down with code:100

mongoDB: shutting down with code:100

在使用mongodb的時候,出現如下異常:

2017-09-22T11:36:26.663+0800 I STORAGE  [initandlisten] exception in initAndListen:72 Requested option conflicts with current storage engine option for directoryPerDB; you requested false but the current server storage is already set to true and cannot be changed

解決方法:

1.以管理員身份進入dos

win+s,輸入cmd,滑鼠右鍵選擇“以管理員身份執行”,然後切到mongodb的bin目錄下

2. remove 掉原有的服務

F:\mongoDB\bin>mongod --remove

3. 去掉--directoryperdb

F:\mongoDB\bin>mongod --config F:\mongoDB\data\mongod.cfg  --serviceName MongoDB --intall(如果沒有mongod.cfg檔案,請看下面的配置)
注:
配置mongod.cfg檔案-->直接在data目錄下建立名為mongod.cfg檔案,內容如下:
## 資料庫檔案目錄
dbpath=F:/mongoDB/data
## 日誌目錄
logpath=F:/mongoDB/log/mongo.log
diaglog=3

4.net start MongoDB