本來(lái)想寫(xiě)Replica的非測(cè)試模式的集群架構(gòu)的,但是實(shí)在是手癢癢,把mongoDB的3.0給download下來(lái)了,看了1兩眼文檔后決定還是先大概寫(xiě)1點(diǎn)點(diǎn)關(guān)于啟動(dòng)的話題,以后寫(xiě)Replica的時(shí)候基本上就用mongoDB 3.0的方式+YAML的 配置方式來(lái)做了。
這個(gè)是default的啟動(dòng)方式。mongod的啟動(dòng)參數(shù)多如牛毛,本來(lái)想有空總結(jié)1下的,我勒個(gè)去的,有些估計(jì)這輩子也用不到的場(chǎng)景也不知道如何寫(xiě),等我再斟酌1下再說(shuō)吧。
storage:
dbPath: C:datamdb
engine: mmapv1
注意,engine這個(gè)地方可以不寫(xiě)哦,默許就是mmapv1。其余那幾10個(gè)參數(shù)先不寫(xiě)了太多了。
C:MongoDB3Server3.0in>mongod -f C:MongoDB3Server3.0etcconfconfig.conf
履行上面的命令后:
2015-03-06T23:50:20.794+0800 I CONTROL [initandlisten] MongoDB starting : pid=1
4116 port=27017 dbpath=C:datamdb 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: OpenSSL
1.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
ongoDB3Server3.0etcconfconfig.conf", storage: { dbPath: "C:datamdb", engi
ne: "mmapv1" } }
2015-03-06T23:50:20.916+0800 I JOURNAL [initandlisten] journal dir=C:datamdb
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
:datamdblocal.ns, filling with zeroes...
2015-03-06T23:50:21.564+0800 I STORAGE [FileAllocator] allocating new datafile
C:datamdblocal.0, filling with zeroes...
2015-03-06T23:50:21.565+0800 I STORAGE [FileAllocator] creating directory C:da
tamdb\_tmp
2015-03-06T23:50:21.570+0800 I STORAGE [FileAllocator] done allocating datafile
C:datamdblocal.0, size: 64MB, took 0.002 secs
2015-03-06T23:50:21.590+0800 I NETWORK [initandlisten] waiting for connections
on port 27017
哇啦啦,跑起來(lái)了。這個(gè)在3.0之前也這樣,沒(méi)啥特殊的。
這個(gè)是需要指定的啟動(dòng)方式。
storage:
dbPath: C:datawdb
engine: wiredTiger
注意,engine這個(gè)地方設(shè)置的是wiredTiger哦。
C:MongoDB3Server3.0in>mongod -f C:MongoDB3Server3.0etcconfconfig.conf
履行上面的命令后:
C:MongoDB3Server3.0in>mongod -f C:MongoDB3Server3.0etcconfconfig.conf
2015-03-06T23:59:56.445+0800 I CONTROL [initandlisten] MongoDB starting : pid=1
4076 port=27017 dbpath=C:datawdb 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: OpenSSL
1.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
ongoDB3Server3.0etcconfconfig.conf", storage: { dbPath: "C:datawdb", 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
上面我啟動(dòng)兩個(gè)mongod使用的是:
C:datamdb : mmapv1模式
C:datawdb : wiredTiger模式
兩個(gè)不同的文件夾,使用的兩個(gè)不同的存儲(chǔ)模式,mongoDB的3.0中強(qiáng)調(diào),當(dāng)指定的dbpath使用的存儲(chǔ)引擎和你的engine不1致的時(shí)候,mongoDB是謝絕啟動(dòng)的哦。
生活不易,碼農(nóng)辛苦
如果您覺(jué)得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)
![]()