下載安裝包後,配置好data和log文件夾路徑之後任然報錯。linux
2016-03-01T13:03:29.325+0800 I CONTROL [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
2016-03-01T13:03:29.330+0800 I CONTROL [main] Trying to start Windows service 'MongoDB'
2016-03-01T13:03:29.333+0800 I STORAGE [thread1] Service running
2016-03-01T13:03:29.333+0800 I CONTROL [initandlisten] MongoDB starting : pid=5792 port=27017 dbpath=d:\mongodb\data\db 32-bit host=1-PC
2016-03-01T13:03:29.333+0800 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-03-01T13:03:29.333+0800 I CONTROL [initandlisten] db version v3.2.3
2016-03-01T13:03:29.333+0800 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] allocator: tcmalloc
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] modules: none
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] build environment:
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] distarch: i386
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] target_arch: i386
2016-03-01T13:03:29.334+0800 I CONTROL [initandlisten] options: { service: true, storage: { dbPath: "d:\mongodb\data\db" }, systemLog: { destination: "file", path: "d:\mongodb\data\log\log.txt" } }
2016-03-01T13:03:29.336+0800 I - [initandlisten] Detected data files in d:\mongodb\data\db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten]
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten] ** WARNING: This 32-bit MongoDB binary is deprecated
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten]
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten]
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten] ** See http://dochub.mongodb.org/core/32bit
2016-03-01T13:03:29.358+0800 I CONTROL [initandlisten]
2016-03-01T13:03:29.365+0800 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-03-01T13:03:29.365+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'd:/mongodb/data/db/diagnostic.data'
2016-03-01T13:03:29.367+0800 I NETWORK [initandlisten] waiting for connections on port 27017
2016-03-01T13:04:53.106+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50695 #1 (1 connection now open)
2016-03-01T13:04:53.106+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50696 #2 (2 connections now open)
2016-03-01T13:04:53.106+0800 I NETWORK [conn1] end connection 127.0.0.1:50695 (0 connections now open)
2016-03-01T13:04:53.108+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50697 #3 (2 connections now open)
2016-03-01T13:04:53.348+0800 I NETWORK [conn2] end connection 127.0.0.1:50696 (1 connection now open)
2016-03-01T13:04:53.352+0800 I NETWORK [conn3] end connection 127.0.0.1:50697 (0 connections now open)
2016-03-01T13:04:53.357+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50699 #4 (1 connection now open)
2016-03-01T13:04:53.360+0800 I NETWORK [conn4] end connection 127.0.0.1:50699 (0 connections now open)
2016-03-01T13:05:00.058+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50704 #5 (1 connection now open)
2016-03-01T13:05:00.058+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50705 #6 (2 connections now open)
2016-03-01T13:05:00.058+0800 I NETWORK [conn5] end connection 127.0.0.1:50704 (1 connection now open)
2016-03-01T13:05:00.059+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50706 #7 (2 connections now open)
2016-03-01T13:05:00.220+0800 I NETWORK [conn6] end connection 127.0.0.1:50705 (1 connection now open)
2016-03-01T13:05:00.309+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:50708 #8 (2 connections now open)
2016-03-01T13:05:10.060+0800 I NETWORK [conn7] end connection 127.0.0.1:50706 (1 connection now open)
2016-03-01T13:05:20.061+0800 I NETWORK [conn8] end connection 127.0.0.1:50708 (0 connections now open)git
Mongodb沒法啓動:The default storage engine 'wiredTiger' is not available with this build of mongod. web
今天在linux上安裝mongodb後(版本爲3.2), 採用命令方式啓動mongdb,結果client登不進去, 看了看日誌, 發現日誌報錯mongodb
啓動命令: ./mongod -port=38200 -dbpath=../data/ -logpath=../log/mongodb.log --logappend --journal;tail -f ../log/mongodb.logshell
客戶端登錄不進去: centos
[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 app
查看日誌記錄, 報錯: less
2016-01-05T17:44:48.336+0800 I CONTROL [initandlisten] db version v3.2.0ui
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: 100
this
查閱了一下, mongodb自3.0版本後新增了wiredTiger的數據存儲引擎, 3.2版本後默認採用的wiredTiger, 不知道爲什麼, 個人這個版本不能使用該引擎? 難道是版本的問題? 查看版本:
[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
系統採用的是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引擎的問題, 後續跟進.
這事解決方法;