mongoDB的读书笔记(via3.0)(00)_【概览】(02)_mongoDB3.0中的mongod启动方式小试牛刀
来源:互联网 发布:极乐净土动作数据下载 编辑:程序博客网 时间:2024/06/06 07:12
mongod启动
本来想写Replica的非测试模式的集群架构的,但是实在是手痒痒,把mongoDB的3.0给download下来了,看了一两眼文档后决定还是先大概写一点点关于启动的话题,之后写Replica的时候基本上就用mongoDB 3.0的方式+YAML的 配置方式来做了。
mongod利用mmapv1启动
这个是default的启动方式。mongod的启动参数多如牛毛,本来想有空总结一下的,我勒个去的,有些估计这辈子也用不到的场景也不知道如何写,等我再考虑一下再说吧。
准备配置文件
storage: dbPath: C:\datam\db engine: mmapv1
注意,engine这个地方可以不写哦,默认就是mmapv1。其余那几十个参数先不写了太多了。
启动
C:\MongoDB3\Server\3.0\bin>mongod -f C:\MongoDB3\Server\3.0\etc\conf\config.conf
执行上面的命令后:
2015-03-06T23:50:20.794+0800 I CONTROL [initandlisten] MongoDB starting : pid=14116 port=27017 dbpath=C:\datam\db 64-bit host=yanglu2015-03-06T23:50:20.798+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-03-06T23:50:20.799+0800 I CONTROL [initandlisten] db version v3.0.02015-03-06T23:50:20.800+0800 I CONTROL [initandlisten] git version: a841fd6394365954886924a35076691b4d1491682015-03-06T23:50:20.802+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 20142015-03-06T23:50:20.803+0800 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_492015-03-06T23:50:20.804+0800 I CONTROL [initandlisten] allocator: system2015-03-06T23:50:20.805+0800 I CONTROL [initandlisten] options: { config: "C:\MongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\datam\db", engine: "mmapv1" } }2015-03-06T23:50:20.916+0800 I JOURNAL [initandlisten] journal dir=C:\datam\db\journal2015-03-06T23:50:20.918+0800 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed2015-03-06T23:50:20.953+0800 I JOURNAL [durability] Durability thread started2015-03-06T23:50:20.954+0800 I JOURNAL [journal writer] Journal writer thread started2015-03-06T23:50:21.167+0800 I INDEX [initandlisten] allocating new ns file C:\datam\db\local.ns, filling with zeroes...2015-03-06T23:50:21.564+0800 I STORAGE [FileAllocator] allocating new datafileC:\datam\db\local.0, filling with zeroes...2015-03-06T23:50:21.565+0800 I STORAGE [FileAllocator] creating directory C:\datam\db\_tmp2015-03-06T23:50:21.570+0800 I STORAGE [FileAllocator] done allocating datafile C:\datam\db\local.0, size: 64MB, took 0.002 secs2015-03-06T23:50:21.590+0800 I NETWORK [initandlisten] waiting for connectionson port 27017
哇啦啦,跑起来了。这个在3.0以前也这样,没啥特殊的。
mongod利用WiredTiger启动
这个是需要指定的启动方式。
准备配置文件
storage: dbPath: C:\dataw\db engine: wiredTiger
注意,engine这个地方设置的是wiredTiger哦。
启动
C:\MongoDB3\Server\3.0\bin>mongod -f C:\MongoDB3\Server\3.0\etc\conf\config.conf
执行上面的命令后:
C:\MongoDB3\Server\3.0\bin>mongod -f C:\MongoDB3\Server\3.0\etc\conf\config.conf2015-03-06T23:59:56.445+0800 I CONTROL [initandlisten] MongoDB starting : pid=14076 port=27017 dbpath=C:\dataw\db 64-bit host=yanglu2015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] db version v3.0.02015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] git version: a841fd6394365954886924a35076691b4d1491682015-03-06T23:59:56.450+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 20142015-03-06T23:59:56.450+0800 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_492015-03-06T23:59:56.451+0800 I CONTROL [initandlisten] allocator: system2015-03-06T23:59:56.453+0800 I CONTROL [initandlisten] options: { config: "C:\MongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\dataw\db", engine: "wiredTiger" } }2015-03-06T23:59:56.457+0800 I STORAGE [initandlisten] wiredtiger_open config:create,cache_size=3G,session_max=20000,eviction=(threads_max=4),statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),2015-03-06T23:59:56.942+0800 I NETWORK [initandlisten] waiting for connectionson port 27017
Storage format的影响
上面我启动两个mongod使用的是:
C:\datam\db : mmapv1模式
C:\dataw\db : wiredTiger模式
两个不同的文件夹,使用的两个不同的存储模式,mongoDB的3.0中强调,当指定的dbpath使用的存储引擎和你的engine不一致的时候,mongoDB是拒绝启动的哦。
–storageEngine string
Default: mmapv1New in version 3.0.0.
Specifies the storage engine for the mongod database. Valid options include mmapv1 and wiredTiger.
If you attempt to start a mongod with a storage.dbPath that contains data files produced by a storage engine other than the one specified by –storageEngine, mongod will refuse to start.
mmapv1上面启动wiredTiger
我们试试对C:\datam\db 使用wiredTiger的引擎:
storage: dbPath: C:\datam\db engine: wiredTiger
结果:
C:\MongoDB3\Server\3.0\bin>mongod -f C:\MongoDB3\Server\3.0\etc\conf\config.conf2015-03-07T00:07:04.052+0800 I CONTROL [initandlisten] MongoDB starting : pid=11576 port=27017 dbpath=C:\datam\db 64-bit host=yanglu2015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] db version v3.0.02015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] git version: a841fd6394365954886924a35076691b4d1491682015-03-07T00:07:04.057+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 20142015-03-07T00:07:04.057+0800 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_492015-03-07T00:07:04.058+0800 I CONTROL [initandlisten] allocator: system2015-03-07T00:07:04.059+0800 I CONTROL [initandlisten] options: { config: "C:\MongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\datam\db", engine: "wiredTiger" } }2015-03-07T00:07:04.062+0800 I STORAGE [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in C:\datam\db created by storage engine 'mmapv1'. The configured storage engine is 'wiredTiger'., terminating2015-03-07T00:07:04.063+0800 I CONTROL [initandlisten] dbexit: rc: 100
2015-03-07T00:07:04.062+0800 I STORAGE [initandlisten] exception in initAndList
en: 28574 Cannot start server. Detected data files in C:\datam\db created by sto
rage engine ‘mmapv1’. The configured storage engine is ‘wiredTiger’., terminatin
g
上面已经很明确写出了我们错误地在mmapv1的上面使用wiredTiger的引擎,无法启动。
wiredTiger上面启动mmapv1
我们试试对C:\dataw\db 使用mmapv1的引擎:
storage: dbPath: C:\dataw\db engine: mmapv1
C:\MongoDB3\Server\3.0\bin>mongod -f C:\MongoDB3\Server\3.0\etc\conf\config.conf2015-03-07T00:10:09.777+0800 I CONTROL [initandlisten] MongoDB starting : pid=15152 port=27017 dbpath=C:\dataw\db 64-bit host=yanglu2015-03-07T00:10:09.781+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R22015-03-07T00:10:09.784+0800 I CONTROL [initandlisten] db version v3.0.02015-03-07T00:10:09.784+0800 I CONTROL [initandlisten] git version: a841fd6394365954886924a35076691b4d1491682015-03-07T00:10:09.789+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 20142015-03-07T00:10:09.790+0800 I CONTROL [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_492015-03-07T00:10:09.792+0800 I CONTROL [initandlisten] allocator: system2015-03-07T00:10:09.793+0800 I CONTROL [initandlisten] options: { config: "C:\MongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\dataw\db", engine: "mmapv1" } }2015-03-07T00:10:09.796+0800 I STORAGE [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in C:\dataw\db created by storage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminating2015-03-07T00:10:09.798+0800 I CONTROL [initandlisten] dbexit: rc: 100
结果可想而知,真的是不可以。
つづく・・・
- mongoDB的读书笔记(via3.0)(00)_【概览】(02)_mongoDB3.0中的mongod启动方式小试牛刀
- mongoDB的读书笔记(via3.0)(00)_【概览】(01)_mongoDB3.0的一些变化
- mongoDB的读书笔记(via3.0)(05)_【Sharding】(03)_关于Shard Keys与Hash的理论知识小絮叨
- mongodb源码分析(二)mongod的启动
- mongodb mongod 启动参数
- mongodb mongod 启动参数
- MongoDB---mongod的网页后台
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- (*)Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- Mongodb启动命令mongod参数说明
- JPG+mask替代透明Png
- 安卓内存回收机制
- UVA 11552-Fewest Flops(DP)
- Metaio in Unity3d 教学--- 二. 创建自己的Application
- 关于刀塔传奇中的那些alpha_mask文件
- mongoDB的读书笔记(via3.0)(00)_【概览】(02)_mongoDB3.0中的mongod启动方式小试牛刀
- Metaio in Unity3d 教学--- 三. 使用ID Marker作为扫描目标
- 黑马程序员 -- IOS C语言 函数
- getimg
- Metaio in Unity3d 教学--- 四.再谈谈图片扫描之tracking配置文件
- java环境变量配置及常见问题
- android中getSystemService详解
- hdu 4336 全期望公式+状态压缩+概率dp
- 【Shell】函数应用简单示例