下载安装包后,配置好data和log文件夹路径以后任然报错。
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)
Mongodb无法启动:The default storage engine 'wiredTiger' is not available with this build of mongod.
今天在linux上安装mongodb后(版本为3.2), 采用命令方式启动mongdb,结果client登不进去, 看了看日志, 发现日志报错
启动命令: ./mongod -port=38200 -dbpath=../data/ -logpath=../log/mongodb.log --logappend --journal;tail -f ../log/mongodb.log
客户端登陆不进去:
[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
查看日志记录, 报错:
2016-01-05T17:44:48.336+0800 I CONTROL [initandlisten] db version v3.2.0
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
查阅了一下, 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引擎的问题, 后续跟进.
这事解决方法;