惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
Martin Fowler
Martin Fowler
A
About on SuperTechFans
H
Help Net Security
F
Full Disclosure
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
H
Heimdal Security Blog
博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
B
Blog RSS Feed
Last Week in AI
Last Week in AI
V2EX - 技术
V2EX - 技术
The Register - Security
The Register - Security
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
美团技术团队
S
Securelist
MyScale Blog
MyScale Blog
Vercel News
Vercel News
L
LINUX DO - 最新话题
Hacker News: Ask HN
Hacker News: Ask HN
W
WeLiveSecurity
M
MIT News - Artificial intelligence
宝玉的分享
宝玉的分享
月光博客
月光博客
Attack and Defense Labs
Attack and Defense Labs
大猫的无限游戏
大猫的无限游戏
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Forbes - Security
Forbes - Security
罗磊的独立博客
O
OpenAI News
AI
AI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
雷峰网
雷峰网
S
Security @ Cisco Blogs
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
V
Visual Studio Blog

博客园 - 我想我是青蛙

将golang程序注册为windows服务 CentOS上安装spark standalone mode(转载) 关于听歌这回事 c#读取apk 信息 golang 读取mongob数据写入sqlserver golang 通用Contains方法 golang读取文件信息插入mongodb PetaPoco介绍 白话MongoDB(三)(转载) 白话MongoDB(一) (转载) 给文章加入关键字链接 针对firefox ie6 ie7 ie8的css样式hack (转载) 好久不写日志了,现在开始,好好写了。。 sharepoint 查询calendar recurrence sharepoint之lookup字段 sharepoint获取Audiences 获取exchangeserve的calendar的item sharepoint错误处理 c#上传下载ftp(支持断点续传)
白话MongoDB(二)(转载)
我想我是青蛙 · 2011-12-28 · via 博客园 - 我想我是青蛙

源地址http://www.ningoo.net/html/2011/mongodb_in_a_nutshell_2.html 作者:NinGoo 

前面扯了一堆,要了解一个东西,最好的办法,还是让他跑起来,然后结合文档和测试,来验证其实现,并且了解其不足和优点。

MongoDB提供了部分系统的编译版本,但从研究学习以及线上不同依赖包的稳定性的目标,个人还是比较推荐从源代码编译安装的方式。MongoDB的源代码依赖了一些基础组件,如js引擎Spider Monkey,正则表达式引擎PCRE,安装构建工具Scons,以及C++的boost库等,因此编译还是有些麻烦的,realzyy的这篇文章已经比较详细的说明了编译的步骤,主要基于Redhat系统。在ubuntu上安装,还有几个注意点:

1. PCRE最好在编译的时候显式指明对UTF-8的支持

$ configure --enable-unicode-properties
$ sudo make -j 2 && make install

 PCRE如果不支持UTF-8,则MongoDB无法启动

Thu Mar 31 17:27:16 Assertion: 10342:pcre not compiled with utf8 support
0x8169528 0x81e704e 0x8450212 0xb73b6ce7 0x80f5b11
 ./mongod(_ZN5mongo11msgassertedEiPKc+0x208) [0x8169528]
 ./mongod(_ZN5mongo6RXTest3runEv+0x3fe) [0x81e704e]
 ./mongod(main+0x3832) [0x8450212]
 /lib/libc.so.6(__libc_start_main+0xe7) [0xb73b6ce7]
 ./mongod() [0x80f5b11]

2. Ubuntu自身带了一个Spider Monkey,但版本有些老,有些MongoDB需要的特性不支持,需要先卸载

$dpkg -l | grep xulrunner
$sudo apt-get remove xulrunner-1.9.2-dev xulrunner-1.9.2

$export CFLAGS=”-DJS_C_STRINGS_ARE_UTF8″
$sudo make -f Makefile.ref
$sudo JS_DIST=/usr make -f Makefile.ref export

3. 需要安装boost等库的支持

$sudo apt-get -y install tcsh git-core scons g++
$sudo apt-get -y install libpcre++-dev libboost-dev libreadline-dev xulrunner-dev
$sudo apt-get -y install libboost-program-options-dev \
libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev

4. 源代码建议从github上下载,根据需要编译相应的版本

$git clone git://github.com/mongodb/mongo.git
$cd mongo
$git tag -l
$git checkout r1.8.0

5.最后,编译安装MongoDB的时候,建议连带头文件和库文件一起

$scons -j 2 all
$scons --prefix=/opt/mongo --full install

另外,MongoDB也可以使用Google V8来作为js引擎,从性能方面来说,V8可能是更好的选择,从jira来看,MongoDB在未来或许会改用v8作为默认引擎。

首先编译V8,然后编译MongoDB的时候使用userv8参数:

$svn checkout http://v8.googlecode.com/svn/trunk/ v8
$cd v8
$scons
$sudo cp libv8.a /usr/lib
$sudo cp libv8preparser.a /usr/lib
$sudo cp -r include/* /usr/include/

$cd mongodb-src
$scons all --usev8
$scons --prefix=/opt/mongo --full install

MongoDB在32位环境下有诸多限制,只能用于学习研究的目的,线上环境一定要使用64位系统。

Thu Mar 31 17:24:58 --oplogSize of 1024MB is too big for 32 bit version. Use 64 bit build instead.

参考:

http://www.mongodb.org/display/DOCS/Building+Spider+Monkey
http://www.mongodb.org/display/DOCS/Building+for+Linux
http://www.howsthe.com/blog/2010/feb/22/mongodb-and-v8/
http://jira.mongodb.org/browse/SERVER-446