一些理论基础:http://blog.csdn.net/yujin2010good/article/details/7671394
mongodb是一种非关系型数据库(nosql),个人觉得比较适合一些关系型不是很复杂的系统,关系太复杂的系统也不好迁移到mongodb上,比如企业erp、crm、oa等业务系统。
注意:
小插曲:什么是NoSql?
NoSql,全称是 Not Only Sql,指的是非关系型的数据库。下一代数据库主要解决几个要点:非关系型的、分布式的、开源的、水平可扩展的。原始的目的是为了大规模web应用,这场运动开始于2009年初,通常特性应用如:模式自由、支持简易复制、简单的API、最终的一致性(非ACID)、大容量数据等。NoSQL被我们用得最多的当数key-value存储,当然还有其他的文档型的、列存储、图型数据库、xml数据库等。
特点:
高性能、易部署、易使用,存储数据非常方便。主要功能特性有:
功能:
适用场合:
官方文档
http://cn.docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
安装过程
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\wolf>cd ..
C:\Documents and Settings>cd..
C:\>d:
D:\>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E44
D:\ 的目录
2011-12-26 10:51 <DIR> cs
2012-07-10 10:41 <DIR> MBA
2012-07-28 21:41 <DIR> mongodb
2012-06-24 18:43 <DIR> oracle
2012-07-23 12:51 <DIR> Program Files
2012-07-20 23:50 <DIR> soft
2012-07-20 22:36 <DIR> system
2012-07-10 11:17 <DIR> tsm5.3
2012-07-27 10:24 37,376余静的工作日志.xls
1 个文件 37,376字节
8 个目录 12,700,495,872可用字节
D:\>cd mongodb
D:\mongodb>cd bin
D:\mongodb\bin>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E4
D:\mongodb\bin 的目录
2012-07-28 21:41 <DIR> .
2012-07-28 21:41 <DIR> ..
2012-06-04 11:37 3,974,144 bsondump.exe
2012-06-04 10:49 1,886,720 mongo.exe
2012-06-04 11:00 4,304,384 mongod.exe
2012-06-04 11:03 3,991,552 mongodump.exe
2012-06-04 11:10 3,980,800 mongoexport.exe
2012-06-04 11:17 3,987,456 mongofiles.exe
2012-06-04 11:14 3,998,720 mongoimport.exe
2012-06-04 11:07 3,986,432 mongorestore.exe
2012-06-04 11:39 3,001,344 mongos.exe
2012-06-04 11:21 4,023,808 mongostat.exe
2012-06-04 11:24 3,987,968 mongotop.exe
11 个文件 41,123,328字节
2 个目录 12,700,495,872可用字节
D:\mongodb\bin>mongod.exe --dbpath d:\mongodb\data
Sat Jul 28 21:43:06
Sat Jul 28 21:43:06 warning: 32-bit servers don't have journaling enabled by def
ault. Please use --journal if you want durability.
Sat Jul 28 21:43:06
Sat Jul 28 21:43:06 [initandlisten] MongoDB starting : pid=5168 port=27017 dbpat
h=d:\mongodb\data 32-bit host=wolf-903a809480
Sat Jul 28 21:43:06 [initandlisten]
Sat Jul 28 21:43:06 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
limited to about 2 gigabytes of data
Sat Jul 28 21:43:06 [initandlisten] ** see http://blog.mongodb.org/post/13
7788967/32-bit-limitations
Sat Jul 28 21:43:06 [initandlisten] ** with --journal, the limit is lower
Sat Jul 28 21:43:06 [initandlisten]
Sat Jul 28 21:43:06 [initandlisten] db version v2.0.6, pdfile version 4.5
Sat Jul 28 21:43:06 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7b
b49fb05bc
Sat Jul 28 21:43:06 [initandlisten] build info: windows sys.getwindowsversion(ma
jor=6, minor=0, build=6002, platform=2, service_pack='Service Pack 2') BOOST_LIB
_VERSION=1_42
Sat Jul 28 21:43:06 [initandlisten] options: { dbpath: "d:\mongodb\data" }
Sat Jul 28 21:43:07 [websvr] admin web console waiting for connections on port 2
8017
Sat Jul 28 21:43:07 [initandlisten] waiting for connections on port 27017
Sat Jul 28 21:43:31 [initandlisten] connection accepted from 127.0.0.1:2086 #1
Sat Jul 28 21:43:31 [conn1] end connection 127.0.0.1:2086
Sat Jul 28 21:43:31 [initandlisten] connection accepted from 127.0.0.1:2087 #2
Sat Jul 28 21:43:31 [conn2] end connection 127.0.0.1:2087
Sat Jul 28 21:43:45 [initandlisten] connection accepted from 127.0.0.1:2089 #3
Sat Jul 28 21:43:45 [conn3] end connection 127.0.0.1:2089
Sat Jul 28 21:43:45 [initandlisten] connection accepted from 127.0.0.1:2090 #4
Sat Jul 28 21:43:45 [conn4] end connection 127.0.0.1:2090
Sat Jul 28 21:44:07 [clientcursormon] mem (MB) res:17 virt:56 mapped:0
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\wolf>cd ..
C:\Documents and Settings>cd ..
C:\>d:
D:\>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E44
D:\ 的目录
2011-12-26 10:51 <DIR> cs
2012-07-10 10:41 <DIR> MBA
2012-07-28 21:41 <DIR> mongodb
2012-06-24 18:43 <DIR> oracle
2012-07-23 12:51 <DIR> Program Files
2012-07-20 23:50 <DIR> soft
2012-07-20 22:36 <DIR> system
2012-07-10 11:17 <DIR> tsm5.3
2012-07-27 10:24 37,376余静的工作日志.xls
1 个文件 37,376字节
8 个目录 12,700,209,152可用字节
D:\>cd mongodb
D:\mongodb>cd bin
D:\mongodb\bin>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E44
D:\mongodb\bin 的目录
2012-07-28 21:41 <DIR> .
2012-07-28 21:41 <DIR> ..
2012-06-04 11:37 3,974,144 bsondump.exe
2012-06-04 10:49 1,886,720 mongo.exe
2012-06-04 11:00 4,304,384 mongod.exe
2012-06-04 11:03 3,991,552 mongodump.exe
2012-06-04 11:10 3,980,800 mongoexport.exe
2012-06-04 11:17 3,987,456 mongofiles.exe
2012-06-04 11:14 3,998,720 mongoimport.exe
2012-06-04 11:07 3,986,432 mongorestore.exe
2012-06-04 11:39 3,001,344 mongos.exe
2012-06-04 11:21 4,023,808 mongostat.exe
2012-06-04 11:24 3,987,968 mongotop.exe
11 个文件 41,123,328字节
2 个目录 12,700,209,152可用字节
D:\mongodb\bin>md d:\mongodb\log
D:\mongodb\bin>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E44
D:\mongodb\bin 的目录
2012-07-28 21:41 <DIR> .
2012-07-28 21:41 <DIR> ..
2012-06-04 11:37 3,974,144 bsondump.exe
2012-06-04 10:49 1,886,720 mongo.exe
2012-06-04 11:00 4,304,384 mongod.exe
2012-06-04 11:03 3,991,552 mongodump.exe
2012-06-04 11:10 3,980,800 mongoexport.exe
2012-06-04 11:17 3,987,456 mongofiles.exe
2012-06-04 11:14 3,998,720 mongoimport.exe
2012-06-04 11:07 3,986,432 mongorestore.exe
2012-06-04 11:39 3,001,344 mongos.exe
2012-06-04 11:21 4,023,808 mongostat.exe
2012-06-04 11:24 3,987,968 mongotop.exe
11 个文件 41,123,328字节
2 个目录 12,700,209,152可用字节
D:\mongodb\bin>cd ..
下面我们把mongodb写入服务
D:\mongodb>dir
驱动器 D中的卷是 TOOLS
卷的序列号是 6C97-9E44
D:\mongodb 的目录
2012-07-28 22:01 <DIR> .
2012-07-28 22:01 <DIR> ..
2012-07-28 21:41 <DIR> bin
2012-07-28 21:43 <DIR> data
2012-06-04 09:49 35,181 GNU-AGPL-3.0
2012-07-28 22:01 <DIR> log
2012-06-04 09:49 1,364 README
2012-06-04 09:49 10,112 THIRD-PARTY-NOTICES
3 个文件 46,657字节
5 个目录 12,700,209,152可用字节
D:\mongodb>echo logpath=d:\mongodb\log > d:\mongodb\mongod.cfg
D:\mongodb>cd bin
D:\mongodb\bin>mongod.exe --config d:\mongodb\mongod.cfg --install
all output going to: d:\mongodb\log
D:\mongodb\bin>net start mongodb
Mongo DB 服务已经启动成功。
D:\mongodb\bin>