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

推荐订阅源

The Last Watchdog
The Last Watchdog
S
Securelist
T
Threat Research - Cisco Blogs
Forbes - Security
Forbes - Security
AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
W
WeLiveSecurity
P
Palo Alto Networks Blog
O
OpenAI News
V2EX - 技术
V2EX - 技术
H
Heimdal Security Blog
L
Lohrmann on Cybersecurity
NISL@THU
NISL@THU
T
Tor Project blog
T
Threatpost
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
A
Arctic Wolf
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Latest news
Latest news
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tenable Blog
量子位
L
LINUX DO - 最新话题
Webroot Blog
Webroot Blog
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
Hacker News: Ask HN
Hacker News: Ask HN
U
Unit 42
T
Tailwind CSS Blog
WordPress大学
WordPress大学
N
News | PayPal Newsroom
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
C
Check Point Blog
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Hacker News
The Hacker News
B
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