mongoDB的读书笔记(via3.0)(00)_【概览】(02)_mongoDB3.0中的mongod启动方式小试牛刀
mongod启动
本来想写Replica的非测试模式的集群架构的,但是实在是手痒痒,把mongoDB的3.0给download下来了,看了一两眼文档后决定还是先大概写一点点关于启动的话题,之后写Replica的时候基本上就用mongoDB 3.0的方式+YAML的 配置方式来做了。
mongod利用mmapv1启动
这个是default的启动方式。mongod的启动参数多如牛毛,本来想有空总结一下的,我勒个去的,有些估计这辈子也用不到的场景也不知道如何写,等我再考虑一下再说吧。
准备配置文件
storage:dbPath: C:\datam\dbengine: 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=1
4116 port=27017 dbpath=C:\datam\db 64-bit host=yanglu
2015-03-06T23:50:20.798+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2015-03-06T23:50:20.799+0800 I CONTROL [initandlisten] db version v3.0.0
2015-03-06T23:50:20.800+0800 I CONTROL [initandlisten] git version: a841fd63943
65954886924a35076691b4d149168
2015-03-06T23:50:20.802+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL1.0.1j-fips 15 Oct 2014
2015-03-06T23:50:20.803+0800 I CONTROL [initandlisten] build info: windows sys.
getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Servic
e Pack 1') BOOST_LIB_VERSION=1_49
2015-03-06T23:50:20.804+0800 I CONTROL [initandlisten] allocator: system
2015-03-06T23:50:20.805+0800 I CONTROL [initandlisten] options: { config: "C:\M
ongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\datam\db", engi
ne: "mmapv1" } }
2015-03-06T23:50:20.916+0800 I JOURNAL [initandlisten] journal dir=C:\datam\db\
journal
2015-03-06T23:50:20.918+0800 I JOURNAL [initandlisten] recover : no journal fil
es present, no recovery needed
2015-03-06T23:50:20.953+0800 I JOURNAL [durability] Durability thread started
2015-03-06T23:50:20.954+0800 I JOURNAL [journal writer] Journal writer thread s
tarted
2015-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 datafile
C:\datam\db\local.0, filling with zeroes...
2015-03-06T23:50:21.565+0800 I STORAGE [FileAllocator] creating directory C:\da
tam\db\_tmp
2015-03-06T23:50:21.570+0800 I STORAGE [FileAllocator] done allocating datafileC:\datam\db\local.0, size: 64MB, took 0.002 secs
2015-03-06T23:50:21.590+0800 I NETWORK [initandlisten] waiting for connections
on port 27017
哇啦啦,跑起来了。这个在3.0以前也这样,没啥特殊的。
mongod利用WiredTiger启动
这个是需要指定的启动方式。
准备配置文件
storage:dbPath: C:\dataw\dbengine: 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=1
4076 port=27017 dbpath=C:\dataw\db 64-bit host=yanglu
2015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] db version v3.0.0
2015-03-06T23:59:56.449+0800 I CONTROL [initandlisten] git version: a841fd63943
65954886924a35076691b4d149168
2015-03-06T23:59:56.450+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL1.0.1j-fips 15 Oct 2014
2015-03-06T23:59:56.450+0800 I CONTROL [initandlisten] build info: windows sys.
getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Servic
e Pack 1') BOOST_LIB_VERSION=1_49
2015-03-06T23:59:56.451+0800 I CONTROL [initandlisten] allocator: system
2015-03-06T23:59:56.453+0800 I CONTROL [initandlisten] options: { config: "C:\M
ongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\dataw\db", engi
ne: "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=(wai
t=60,log_size=2GB),statistics_log=(wait=0),
2015-03-06T23:59:56.942+0800 I NETWORK [initandlisten] waiting for connections
on 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\dbengine: 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=1
1576 port=27017 dbpath=C:\datam\db 64-bit host=yanglu
2015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] db version v3.0.0
2015-03-07T00:07:04.056+0800 I CONTROL [initandlisten] git version: a841fd63943
65954886924a35076691b4d149168
2015-03-07T00:07:04.057+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL1.0.1j-fips 15 Oct 2014
2015-03-07T00:07:04.057+0800 I CONTROL [initandlisten] build info: windows sys.
getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Servic
e Pack 1') BOOST_LIB_VERSION=1_49
2015-03-07T00:07:04.058+0800 I CONTROL [initandlisten] allocator: system
2015-03-07T00:07:04.059+0800 I CONTROL [initandlisten] options: { config: "C:\M
ongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\datam\db", engi
ne: "wiredTiger" } }
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
2015-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\dbengine: 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=1
5152 port=27017 dbpath=C:\dataw\db 64-bit host=yanglu
2015-03-07T00:10:09.781+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2015-03-07T00:10:09.784+0800 I CONTROL [initandlisten] db version v3.0.0
2015-03-07T00:10:09.784+0800 I CONTROL [initandlisten] git version: a841fd63943
65954886924a35076691b4d149168
2015-03-07T00:10:09.789+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL1.0.1j-fips 15 Oct 2014
2015-03-07T00:10:09.790+0800 I CONTROL [initandlisten] build info: windows sys.
getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Servic
e Pack 1') BOOST_LIB_VERSION=1_49
2015-03-07T00:10:09.792+0800 I CONTROL [initandlisten] allocator: system
2015-03-07T00:10:09.793+0800 I CONTROL [initandlisten] options: { config: "C:\M
ongoDB3\Server\3.0\etc\conf\config.conf", storage: { dbPath: "C:\dataw\db", engi
ne: "mmapv1" } }
2015-03-07T00:10:09.796+0800 I STORAGE [initandlisten] exception in initAndList
en: 28574 Cannot start server. Detected data files in C:\dataw\db created by sto
rage engine 'wiredTiger'. The configured storage engine is 'mmapv1'., terminatin
g
2015-03-07T00:10:09.798+0800 I CONTROL [initandlisten] dbexit: rc: 100
结果可想而知,真的是不可以。
つづく・・・
mongoDB的读书笔记(via3.0)(00)_【概览】(02)_mongoDB3.0中的mongod启动方式小试牛刀相关推荐
- 读书笔记 Tom Expert 00章-配置环境
Scott用户激活 Scott修改密码,激活帐号.alter user scott identified by tiger;alter user scott account unlock; 没有的话, ...
- mysql4.0升级_再遇MySQL4.0升级到MySQL5.1的时候
已经好久没搞过MySQL4.0升级到MySQL4.1/MySQL5.0/MySQL5.1的操作了.昨天晚上一个朋友的服务器有几个数据库需要做这样的操作. 冷不丁再遇到这样的情况的确有点楞,不过好在之前 ...
- mongoDB的读书笔记(04)_【Replica】(01)_Replica的一些基本概念
数据库分布已经是当下互联网的标准配置.原来单节点标准配置,一台web服务器,一台数据库服务器的1+1模式,可以应对一个小公司或者少量的访问量.而随着服务的提升,对于7×24×365的高可用性的要求的需 ...
- MongoDB CookBook读书笔记之导入导出
本文主要介绍MongoDB的导入导出操作. 一.导入数据 MongoDB支持csv格式的数据导入.本节除了导入MongoDB CookBook书本提供的测试数据,还介绍了其他格式的csv文件数据导入. ...
- MongoDB实战读书笔记(二):面向文档的数据
1 schema设计原则 1.1 关系型数据库的三大设计范式 第一范式(1NF)无重复的列 第二范式(2NF)属性完全依赖于主键 [ 消除部分子函数依赖 ] 第三范式(3NF)属性不依赖于其它非主属性 ...
- 《C++ Primer》读书笔记——第十三章_拷贝控制
一个类有5种特殊的成员函数:拷贝构造函数.拷贝赋值运算符.移动构造函数.移动赋值运算符.析构函数.如果没有定义这些拷贝控制成员,编译器会自动为它定义缺失的操作. A a; A b = a;//报错 1 ...
- 【读书笔记】 我编程_我快乐——程序员职业规划之道
快要放假了,最后坚挺的时刻,读本书吧.<我编程,我快乐 --程序员职业规划之道>. 1, 当你开始做一个程序的时候,或许手头上有一个从网上复制的示例程序,看上去这个程序可以使用.为了满足你 ...
- mysql8.0.19.0安装_一、MySQL8.0.19 安装教程
1. 下载MySQL 8.0.19(免安装版) 预览图 下载首页.png image.png image.png 2. 解压到相应的目录 D:\APPMULU\mysql-8.0.19 3. 配置环境 ...
- spring3.0异步_在Spring 4.2中更简单地处理异步事务绑定事件
spring3.0异步 介绍 如您可能已经知道的(例如,从我以前的博客文章中 ),不再需要创建一个单独的类来实现带有onApplicationEvent方法的ApplicationListener , ...
最新文章
- Java虚拟机JVM学习06 自定义类加载器 父委托机制和命名空间的再讨论
- 【青少年编程】【三级】 魔术表演“开花”
- 关于实验中的makefile相关知识
- LeetCode—1290.二进制链表转整数(Java)
- php mysql八大动态w...,PHP+MySQL八大动态Web应用实战
- Active Directory边界
- Java中创建对象的5种方式
- LeetCode 1869. 哪种连续子字符串更长
- python2和python3的默认编码_python2和python3哪个版本新
- 2019文献汇总 | 单细胞与病毒感染
- 文字垂直居中(HTML、CSS)
- (2022最新)Java毕业设计参考题目-题目新颖(值得收藏)
- JavaScript编写的《人生不纠结模拟器》
- DSP学习(3)—— DSP调试与追踪
- 妄想性仮想人格障害 汉化补丁(BUG修正)
- Office2010打开多个excel文件时,开多个excel而不是同一个切换
- endless walk
- Win10电脑怎么取消开机密码?
- cla作用matlab,健身搞肌运动补剂小讲堂:共轭亚油酸CLA功效解析
- ChucK初步(7)