MongoDB学习—(1)安装时出现The default storage engine 'wiredTiger' is not available问题解决

MongoDB是NoSql类型的一种基于分布式文件存储的数据库,其存储方式与关系型数据库不同。其详细解释可见于[百科]。安装文件可从官网下载,官网:http://mongodb.org

我将下载的解压文件放到D盘的mongodb文件夹下,MongoDB学习—(1)安装时出现The default storage engine 'wiredTiger' is not available问题解决_第1张图片

bin目录中就有操作所需的各个文件,在命令行中cd到bin目录下,输入

mongod.exe --dbpath  D:\mongodbData (你的数据库数据存放目录)

指定你数据存放位置


回车时如果出现下面的问题:

C:\Program Files\MongoDB\Server\3.2\bin>mongod.exe -dbpath D:\mongodbData
2016-03-01T21:51:39.279+0800 I CONTROL  [main]
2016-03-01T21:51:39.281+0800 W CONTROL  [main] 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
2016-03-01T21:51:39.282+0800 I CONTROL  [main]
2016-03-01T21:51:39.303+0800 I CONTROL  [initandlisten] MongoDB starting : pid=11348 port=27017 dbpath=D:\mongodbData 32-bit host=home-pc
2016-03-01T21:51:39.303+0800 I CONTROL  [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2016-03-01T21:51:39.304+0800 I CONTROL  [initandlisten] db version v3.2.3
2016-03-01T21:51:39.304+0800 I CONTROL  [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-03-01T21:51:39.305+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2016-03-01T21:51:39.305+0800 I CONTROL  [initandlisten] modules: none
2016-03-01T21:51:39.305+0800 I CONTROL  [initandlisten] build environment:
2016-03-01T21:51:39.306+0800 I CONTROL  [initandlisten]     distarch: i386
2016-03-01T21:51:39.306+0800 I CONTROL  [initandlisten]     target_arch: i386
2016-03-01T21:51:39.307+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "D:\mongodbData" } }
2016-03-01T21:51:39.310+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-03-01T21:51:39.310+0800 I CONTROL  [initandlisten] dbexit:  rc: 100
这是存储引擎出现错误,即默认的存储引擎(default storage engine)原本为wiredTiger,wiredTiger这个存储引擎不适合mongodb,所以mongodb无法使用,当然就无法建立数据存储路径,将存储引擎换成mmapv1就可以了:

MongoDB学习—(1)安装时出现The default storage engine 'wiredTiger' is not available问题解决_第2张图片

然后再将bin所在的路径添加到系统路径中就可以了,以后要使用mongodb都要先启动,即先执行mongod.exe,我们只要把

mongod.exe -dbpath D:\mongodbData -storageEngine=mmapv1

写到一个bat文件里就可以了,若要使用mongo的shell,则执行mongo.exe就可以了,当然也可以将mongo.exe写到一个bat文件中,如:


这样点击这两个文件就可以了。

你可能感兴趣的:(mongodb,数据库,存储引擎,NoSQL)