Mongodb沒法啓動:The default storage engine

今天在linux上安裝mongodb後(版本爲3.2), 採用命令方式啓動mongdb,結果client登不進去, 看了看日誌, 發現日誌報錯linux

 

啓動命令: ./mongod -port=38200 -dbpath=../data/ -logpath=../log/mongodb.log --logappend --journal;tail -f ../log/mongodb.loggit

客戶端登錄不進去: mongodb

[root@centos bin]# ./mongo -port=38200
MongoDB shell version: 3.2.0
connecting to: 127.0.0.1:38200/test
2016-01-05T17:55:27.991+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:38200, reason: errno:111 Connection refused
2016-01-05T17:55:27.992+0800 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:38200, connection attempt failed :
connect@src/mongo/shell/mongo.js:226:14
@(connect):1:6
exception: connect failed       shell

查看日誌記錄, 報錯: centos

2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] db version v3.2.0app

2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] modules: none
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] build environment:
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten]     distarch: i686
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten]     target_arch: i386
2016-01-05T17:44:48.336+0800 I CONTROL  [initandlisten] options: { net: { port: 38200 }, storage: { dbPath: "../data/", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "../log/mongodb.log" } }
2016-01-05T17:44:48.381+0800 I STORAGE  [initandlisten] exception in initAndListen: 28663 Cannot start server. The default storage engine 'wiredTiger' is not available with this build of mongod. Please specify a different storage engine explicitly, e.g. --storageEngine=mmapv1., terminating
2016-01-05T17:44:48.381+0800 I CONTROL  [initandlisten] dbexit:  rc: 100ui

 

查閱了一下, mongodb自3.0版本後新增了wiredTiger的數據存儲引擎, 3.2版本後默認採用的wiredTiger, 不知道爲什麼, 個人這個版本不能使用該引擎? 難道是版本的問題? 查看版本: this

[root@centos bin]# uname -a
Linux centos 2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013 i686 i686 i386 GNU/Linux.net

系統採用的是centos版本.日誌

既然默認的wiredTiger不能用, 那麼採用指定引擎爲mmapv1吧,這應該能夠用了吧. 

因而命令變動爲: 

   ./mongod -port=38200 -storageEngine=mmapv1  -dbpath=../data/ -logpath=../log/mongodb.log --logappend --journal;

這時,客戶端登錄, 能夠登錄了. 

可是服務端會掛在那兒, 若是ctrl+c, 會終止mongodb的運行, 須要再加上參數使以後臺運行--fork. 

最終命令爲: 

    ./mongod -port=38200 -storageEngine=mmapv1  -dbpath=../data/ -logpath=../log/mongodb.log 

--logappend --journal --fork;

至此, 問題解決. 參數能夠所有放在一個conf配置文件裏面, 命令能夠寫成一個腳本. 

至於爲何會報這個問題: 即mmapv1和wiredTiger引擎的問題, 後續跟進.

相關文章
相關標籤/搜索