蒋烨的博客园

导航

 

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引擎的问题, 后续跟进.

posted on 2016-01-08 11:16  蒋烨  阅读(4092)  评论(0编辑  收藏  举报