monbgodb简介 主页 http://www.mongodb.org/

oschina.net 介绍页 http://www.oschina.net/p/mongodb

MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。他支持的数据结构非常松散,是类似json的bjson格式,因此可以存储比较复杂的数据类型。Mongo最大的特点是他支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。

它的特点是高性能、易部署、易使用,存储数据非常方便。主要功能特性有:

面向集合存储,易存储对象类型的数据。
模式自由。
支持动态查询。
支持完全索引,包含内部对象。
支持查询。
支持复制和故障恢复。
使用高效的二进制数据存储,包括大型对象(如视频等)。
自动处理碎片,以支持云计算层次的扩展性
支持RUBY,PYTHON,JAVA,C++,PHP等多种语言。
文件存储格式为BSON(一种JSON的扩展)
可通过网络访问
所谓“面向集合”(Collenction-Orented),意思是数据被分组存储在数据集中,被称为一个集合(Collenction)。每个 集合在数据库中都有一个唯一的标识名,并且可以包含无限数目的文档。集合的概念类似关系型数据库(RDBMS)里的表(table),不同的是它不需要定 义任何模式(schema)。
模式自由(schema-free),意味着对于存储在mongodb数据库中的文件,我们不需要知道它的任何结构定义。如果需要的话,你完全可以把不同结构的文件存储在同一个数据库里。
存储在集合中的文档,被存储为键-值对的形式。键用于唯一标识一个文档,为字符串类型,而值则可以是各中复杂的文件类型。我们称这种存储形式为BSON(Binary Serialized dOcument Format)。

MongoDB服务端可运行在Linux、Windows或OS X平台,支持32位和64位应用,默认端口为27017。推荐运行在64位平台,因为MongoDB

在32位模式运行时支持的最大文件尺寸为2GB。

MongoDB把数据存储在文件中(默认路径为:/data/db),为提高效率使用内存映射文件进行管理。

在linux下先编译安装下吧。下载mongodb源码 http://downloads.mongodb.org/src/mongodb-src-r2.4.4.tar.gz

也可以下载二进制的,有各种平台的。80多MB,挺大的。建议下载二进制,因为源码编译 虽然眼前一亮,学到点新东西,但是编译体积太大了。我来研究下源码编译mongodb吧。

解压mongodb-src-r2.4.4.tar.gz后,进入目录,发现没有configure或者Makefile,一时木了,不知所戳,姑搜索 编译mongodb ,原来是这样啊:

第一步  安装SCons

Scons是一个Python写的自动化构建工具,比传统的GNU make更加简便、可靠以及高效。
到http://sourceforge.net/projects/scons/files/scons/下载源码压缩包,解压之后按照如下步骤进行安装:

python setup.py install

Centos下也可以yum install scons

第二步 编译Mongodb

进入mongodb源码目录

scons all scons –prefix=/usr/local/mongodb install -j 8

如果想要头文件和lib包,执行

scons –prefix=/usr/local/mongodb –full install -j 8

默认编译完毕要花很久的时间,而且编译体积太大了。查看下源码目录

[root@xen1 mongodb-src-r2.4.4]# du -sh * #去掉小于1M的了
15M     authTest
252M    bsondump
8.3G    build
4.0M    buildscripts
16M     clientTest
15M     firstExample6.2M    httpClientTest
5.5M    jstests
114M    mongo
252M    mongobridge
254M    mongod
253M    mongodump
252M    mongoexport
253M    mongofiles
253M    mongoimport
252M    mongooplog
252M    mongoperf
253M    mongorestore
182M    mongos
253M    mongostat
252M    mongotop
253M    perftest
15M     rsExample
15M     secondExample
71M     src
361M    test
15M     tutorial
15M     whereExample
xxK     ...
[root@xen1 mongodb-src-r2.4.4]# pwd
/root/mongodb-src-r2.4.4
[root@xen1 mongodb-src-r2.4.4]# du -sh .
13G     .
[root@xen1 mongodb-src-r2.4.4]#ll
总用量 4141620
-rw-rw-r--  1 root root     11358 6月   3 04:58 APACHE-2.0.txt
-rwxr-xr-x  1 root root  15207135 6月  20 12:28 authTest
-rwxr-xr-x  1 root root    543371 6月  20 12:29 bsondemo
-rwxr-xr-x  1 root root 264008056 6月  20 12:19 bsondump
drwxr-xr-x  3 root root      4096 6月  20 13:16 build
drwxrwxr-x  4 root root      4096 6月  20 11:27 buildscripts
-rwxr-xr-x  1 root root  15821236 6月  20 12:28 clientTest
-rw-rw-r--  1 root root      2948 6月   3 04:58 CONTRIBUTING.rst
drwxrwxr-x  2 root root      4096 6月   3 04:58 debian
drwxrwxr-x  3 root root      4096 6月   3 04:58 distsrc
drwxrwxr-x  2 root root      4096 6月   3 04:58 docs
-rw-rw-r--  1 root root     10808 6月   3 04:58 doxygenConfig
-rwxr-xr-x  1 root root  15211226 6月  20 12:28 firstExample
-rw-rw-r--  1 root root     34520 6月   3 04:58 GNU-AGPL-3.0.txt
-rwxr-xr-x  1 root root   6440685 6月  20 12:28 httpClientTest
drwxrwxr-x 22 root root     24576 6月   3 04:58 jstests
-rwxr-xr-x  1 root root 119133125 6月  20 11:42 mongo
-rw-rw-r--  1 root root       191 6月   3 04:58 mongo_astyle
-rwxr-xr-x  1 root root 264063672 6月  20 12:25 mongobridge
-rwxr-xr-x  1 root root 265599076 6月  20 12:01 mongod
-rwxr-xr-x  1 root root 264731994 6月  20 12:06 mongodump
-rwxr-xr-x  1 root root 264216054 6月  20 12:09 mongoexport
-rwxr-xr-x  1 root root 264568847 6月  20 12:18 mongofiles
-rwxr-xr-x  1 root root 264465437 6月  20 12:11 mongoimport
-rwxr-xr-x  1 root root 264239179 6月  20 12:16 mongooplog
-rwxr-xr-x  1 root root 263957415 6月  20 12:21 mongoperf
-rwxr-xr-x  1 root root 264674145 6月  20 12:07 mongorestore
-rwxr-xr-x  1 root root 190460179 6月  20 12:04 mongos
-rwxr-xr-x  1 root root 264779175 6月  20 12:12 mongostat
-rwxr-xr-x  1 root root 264125459 6月  20 12:14 mongotop
-rwxr-xr-x  1 root root 264976307 6月  20 12:23 perftest
-rwxrwxr-x  1 root root      1769 6月   3 04:58 README
drwxrwxr-x  2 root root      4096 6月   3 04:58 rpm
-rwxr-xr-x  1 root root  15304506 6月  20 12:28 rsExample
-rw-rw-r--  1 root root      2251 6月   3 04:58 SConscript.buildinfo
-rw-rw-r--  1 root root      6178 6月   3 04:58 SConscript.smoke
-rw-rw-r--  1 root root     38380 6月   3 04:58 SConstruct
-rwxr-xr-x  1 root root  15199859 6月  20 12:29 secondExample
drwxrwxr-x  3 root root      4096 6月  20 11:27 site_scons
drwxrwxr-x  4 root root      4096 6月   3 04:58 src
-rwxr-xr-x  1 root root 378493910 6月  20 12:41 test
-rwxr-xr-x  1 root root  15299544 6月  20 12:29 tutorial
-rw-rw-r--  1 root root       254 6月   3 04:58 valgrind.suppressions
-rwxr-xr-x  1 root root  15257921 6月  20 12:29 whereExample
-rw-rw-r--  1 root root       448 6月   3 04:58 win2008plus.props
[root@xen1 mongodb-src-r2.4.4]# 
View Code

相关文章:

  • 2021-09-22
  • 2022-12-23
  • 2021-12-10
  • 2021-12-07
  • 2022-12-23
  • 2021-10-28
猜你喜欢
  • 2021-06-11
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-08-27
相关资源
相似解决方案