<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>浮山狼de博客 &#187; MongoDB</title>
	<atom:link href="https://www.fushanlang.com/tag/mongodb/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fushanlang.com</link>
	<description>next station - 下一站，活在当下，且行且思</description>
	<lastBuildDate>Sat, 29 Nov 2014 15:14:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.5</generator>
	<item>
		<title>CentOS 安装 mongobdb 和 php mongodb扩展</title>
		<link>https://www.fushanlang.com/centos-to-install-mongobdb-and-php-the-mongodb-expansion-2105/</link>
		<comments>https://www.fushanlang.com/centos-to-install-mongobdb-and-php-the-mongodb-expansion-2105/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 15:14:50 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=2105</guid>
		<description><![CDATA[<p>1。准备工作第一步 升级php</p> <p>默认CentOS 5.5 的 php版本 是 5.1.6 ，为了更好的使用 mongodb，首先升级到php-5.2.17 ，具体操作如下</p> <p># rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</p> <p># vi /etc/yum.repos.d/CentOS-Base.repo 增加下面信息</p> [utterramblings] name=Jason's Utter Ramblings Repo baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka <p>执行命令，自动升级。</p> yum update php -y yum install libmcrypt -y <p>2.安装gcc （如果没有安装gcc的话)</p> <p>yum install gcc</p> <p>3.安装 mongodb</p> <p>pecl install mongo</p> <p>如果报错 phpize找不到，可以安装php-devel</p> yum install php-devel <p>service mongod <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/centos-to-install-mongobdb-and-php-the-mongodb-expansion-2105/">CentOS 安装 mongobdb 和 php mongodb扩展</a></span>]]></description>
				<content:encoded><![CDATA[<p><strong>1。准备工作第一步 升级php</strong></p>
<p>默认CentOS 5.5 的 php版本 是 5.1.6 ，为了更好的使用 mongodb，首先升级到php-5.2.17 ，具体操作如下</p>
<p><a href="http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka" target="_blank"># rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</a><wbr></wbr></p>
<p># vi /etc/yum.repos.d/CentOS-Base.repo 增加下面信息</p>
<pre>
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
</pre>
<p>执行命令，自动升级。</p>
<pre>
yum update php -y
yum install libmcrypt -y
</pre>
<p><strong>2.安装gcc （如果没有安装gcc的话)</strong></p>
<p>yum install gcc<span id="more-2105"></span></p>
<p><strong>3.安装 mongodb</strong></p>
<p>pecl install mongo</p>
<p>如果报错 phpize找不到，可以安装php-devel</p>
<pre><strong>yum install php-devel</strong></pre>
<p>service mongod start 开启 mongodb 服务</p>
<p><strong>4.配置 php 扩展</strong></p>
<pre>
/etc/php.ini 添加&gt;&gt;&gt;&gt;

; Enable mongo extension module
extension=mongo.so

; option documentation: http://www.php.net/manual/en/mongo.configuration.php

; If persistent connections are allowed.
;mongo.allow_persistent = 1

; Whether to reconnect to the database if the connection is lost.
;mongo.auto_reconnect = 1

; The number of bytes-per-chunk.
; This number must be at least 100 less than 4 megabytes (max: 4194204)
;mongo.chunk_size = 262144

; A character to be used in place of $ in modifiers and comparisons.
;mongo.cmd = $

; Default hostname when nothing is passed to the constructor.
;mongo.default_host = localhost

; The default TCP port number. The database's default is 27017.
;mongo.default_port = 27017

; Return a BSON_LONG as an instance of MongoInt64
; (instead of a primitive type).
;mongo.long_as_object = 0

; Use MongoDB native long (this will default to true for 1.1.0)
mongo.native_long = true

; If an exception should be thrown for non-UTF8 strings.
; This option will be eliminated and exceptions always thrown for non-UTF8
; strings starting with version 1.1.0.
mongo.utf8 = 1
</pre>
<p>&gt;&gt;&gt;&gt;或者将如上代码 放入/etc/php.d/mongo.ini</p>
<p>然后 重启 httpd 　service httpd restart.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/centos-to-install-mongobdb-and-php-the-mongodb-expansion-2105/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongodb数据库操作语法</title>
		<link>https://www.fushanlang.com/mongodb-grammar-database-operations-1273/</link>
		<comments>https://www.fushanlang.com/mongodb-grammar-database-operations-1273/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 01:34:00 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=1273</guid>
		<description><![CDATA[Mongodb数据库操作语法，一些命令的中文释义，以及用传统sql来诠释Mongodb的一些操作 <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/mongodb-grammar-database-operations-1273/">Mongodb数据库操作语法</a></span>]]></description>
				<content:encoded><![CDATA[<table style="width: 96%;" border="1" cellspacing="0" cellpadding="0" align="center">
<tbody>
<tr>
<td  valign="top">db.AddUser(username,password)</td>
<td  valign="top">添加用户</td>
</tr>
<tr>
<td  valign="top">db.auth(usrename,password)</td>
<td  valign="top">设置数据库连接验证</td>
</tr>
<tr>
<td  valign="top">db.cloneDataBase(fromhost)</td>
<td  valign="top">从目标服务器克隆一个数据库</td>
</tr>
<tr>
<td  valign="top">db.commandHelp(name)</td>
<td  valign="top"> 返回某条操作命令的帮助</td>
</tr>
<tr>
<td  valign="top">db.copyDatabase(fromdb,todb,fromhost)</td>
<td  valign="top"> 复制数据库fromdb&#8212;源数据库名称，todb&#8212;目标数据库名称，fromhost&#8212;源数据库服务器地址</td>
</tr>
<tr>
<td  valign="top">db.createCollection(name,{size:3333,capped:333,max:88888})</td>
<td  valign="top">创建一个数据集，相当于一个表</td>
</tr>
<tr>
<td  valign="top">db.currentOp()</td>
<td  valign="top">取消当前库的当前操作</td>
</tr>
<tr>
<td  valign="top">db.dropDataBase()</td>
<td  valign="top">删除当前数据库</td>
</tr>
<tr>
<td  valign="top">db.eval(func,args)</td>
<td  valign="top">run code server-side</td>
</tr>
<tr>
<td  valign="top">db.getCollection(cname)</td>
<td  valign="top">取得一个数据集合，同用法：db[&#8216;cname&#8217;] or db.cname</td>
</tr>
<tr>
<td  valign="top">db.getCollenctionNames()</td>
<td  valign="top"> 取得所有数据集合的名称列表</td>
</tr>
<tr>
<td  valign="top">db.getLastError()</td>
<td  valign="top"> 返回最后一个错误的提示消息</td>
</tr>
<tr>
<td  valign="top">db.getLastErrorObj()</td>
<td  valign="top">返回最后一个错误的对象</td>
</tr>
<tr>
<td  valign="top">db.getMongo()</td>
<td  valign="top">取得当前服务器的连接对象get the server connection object</td>
</tr>
<tr>
<td  valign="top">db.getMondo().setSlaveOk()</td>
<td  valign="top">allow this connection to read from then nonmaster membr of a replica pair</td>
</tr>
<tr>
<td  valign="top">db.getName()</td>
<td  valign="top">返回当操作数据库的名称</td>
</tr>
<tr>
<td  valign="top">db.getPrevError()</td>
<td  valign="top">返回上一个错误对象</td>
</tr>
<tr>
<td  valign="top">db.getProfilingLevel()</td>
<td  valign="top">?什么等级</td>
</tr>
<tr>
<td  valign="top">db.getReplicationInfo()</td>
<td  valign="top"> ?什么信息</td>
</tr>
<tr>
<td  valign="top">db.getSisterDB(name)</td>
<td  valign="top">get the db at the same server as this onew</td>
</tr>
<tr>
<td  valign="top">db.killOp()</td>
<td  valign="top"> 停止（杀死）在当前库的当前操作</td>
</tr>
<tr>
<td  valign="top">db.printCollectionStats()</td>
<td  valign="top"> 返回当前库的数据集状态</td>
</tr>
<tr>
<td  valign="top">db.printReplicationInfo()</td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.printSlaveReplicationInfo()</td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.printShardingStatus()</td>
<td  valign="top">返回当前数据库是否为共享数据库</td>
</tr>
<tr>
<td  valign="top">db.removeUser(username)</td>
<td  valign="top"> 删除用户</td>
</tr>
<tr>
<td  valign="top">db.repairDatabase()</td>
<td  valign="top">修复当前数据库</td>
</tr>
<tr>
<td  valign="top">db.resetError()</td>
<td  valign="top">  error</td>
</tr>
<tr>
<td  valign="top">db.runCommand(cmdObj)</td>
<td  valign="top"> run a database command. if cmdObj is a string, turns it into {cmdObj:1}</td>
</tr>
<tr>
<td  valign="top">db.setProfilingLevel(level)</td>
<td  valign="top">0=off,1=slow,2=all</td>
</tr>
<tr>
<td  valign="top">db.shutdownServer()</td>
<td  valign="top">关闭当前服务程序</td>
</tr>
<tr>
<td  valign="top">db.version()</td>
<td  valign="top">返回当前程序的版本信息</td>
</tr>
<tr>
<td  valign="top">数据集(表)操作语法</td>
<td  valign="top">数据集(表)操作语法</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10})</td>
<td  valign="top"> 返回linlin数据集ID=10的数据集</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10}).count()</td>
<td  valign="top">返回linlin数据集ID=10的数据总数</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10}).limit(2)</td>
<td  valign="top">返回linlin数据集ID=10的数据集从第二条开始的数据集</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10}).skip(8)</td>
<td  valign="top">返回linlin数据集ID=10的数据集从0到第八条的数据集</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10}).limit(2).skip(8)</td>
<td  valign="top">返回linlin数据集ID=1=的数据集从第二条到第八条的数据</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({id:10}).sort()</td>
<td  valign="top"> 返回linlin数据集ID=10的排序数据集</td>
</tr>
<tr>
<td  valign="top">db.linlin.findOne([query])</td>
<td  valign="top">返回符合条件的一条数据</td>
</tr>
<tr>
<td  valign="top">db.linlin.getDB()</td>
<td  valign="top">返回此数据集所属的数据库名称</td>
</tr>
<tr>
<td  valign="top">db.linlin.getIndexes()</td>
<td  valign="top">返回些数据集的索引信息</td>
</tr>
<tr>
<td  valign="top">db.linlin.group({key:&#8230;,initial:&#8230;,reduce:&#8230;[,cond:&#8230;]})</td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.linlin.mapReduce(mayFunction,reduceFunction,&lt;optional params&gt;)</td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.linlin.remove(query)</td>
<td  valign="top"> 在数据集中删除一条数据</td>
</tr>
<tr>
<td  valign="top">db.linlin.renameCollection(newName)</td>
<td  valign="top"> 重命名些数据集名称</td>
</tr>
<tr>
<td  valign="top">db.linlin.save(obj)</td>
<td  valign="top">往数据集中插入一条数据</td>
</tr>
<tr>
<td  valign="top">db.linlin.stats()</td>
<td  valign="top">返回此数据集的状态</td>
</tr>
<tr>
<td  valign="top">db.linlin.storageSize()</td>
<td  valign="top"> 返回此数据集的存储大小</td>
</tr>
<tr>
<td  valign="top">db.linlin.totalIndexSize()</td>
<td  valign="top">返回此数据集的索引文件大小</td>
</tr>
<tr>
<td  valign="top">db.linlin.totalSize()</td>
<td  valign="top"> 返回些数据集的总大小</td>
</tr>
<tr>
<td  valign="top">db.linlin.update(query,object[,upsert_bool])</td>
<td  valign="top">在此数据集中更新一条数据</td>
</tr>
<tr>
<td  valign="top">db.linlin.validate()</td>
<td  valign="top">验证此数据集</td>
</tr>
<tr>
<td  valign="top">db.linlin.getShardVersion()</td>
<td  valign="top">返回数据集共享版本号</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({&#8216;name':&#8217;foobar&#8217;})</td>
<td  valign="top">select * from linlin where name=&#8217;foobar&#8217;</td>
</tr>
<tr>
<td  valign="top">db.linlin.find()</td>
<td  valign="top">select * from linlin</td>
</tr>
<tr>
<td  valign="top">db.linlin.find({&#8216;ID':10}).count()</td>
<td  valign="top">select count(*) from linlin where</td>
</tr>
<tr>
<td  valign="top">db.linlin.find().skip(10).limit(20)</td>
<td  valign="top">从查询结果的第十条开始读20条数据</td>
</tr>
<tr>
<td  valign="top">select * from linlin limit 10,20&#8212;&#8212;&#8212;-mysql</td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.linlin.find({&#8216;ID':{$in:[25,35,45]}})</td>
<td  valign="top">select * from linlin where ID in (25,35,45)</td>
</tr>
<tr>
<td  valign="top">db.linlin.find().sort({&#8216;ID':-1})</td>
<td  valign="top"> select * from linlin order by ID desc</td>
</tr>
<tr>
<td  valign="top">db.linlin.distinct(&#8216;name&#8217;,{&#8216;ID':{$lt:20}})</td>
<td  valign="top"> select distinct(name) from linlin where ID&lt;20</td>
</tr>
<tr>
<td  valign="top"> </td>
<td  valign="top"> </td>
</tr>
<tr>
<td  valign="top">db.linlin.group({key:{&#8216;name':true},cond:{&#8216;name':&#8217;foo&#8217;},reduce:function(obj,prev){prev.msum=obj.marks;},initial:{msum:0}})</td>
<td  valign="top">select name,sum(marks) from linlin group by name</td>
</tr>
<tr>
<td  valign="top">db.linlin.find(&#8216;this.ID&lt;20&#8242;,{name:1})</td>
<td  valign="top">select name from linlin where ID&lt;20</td>
</tr>
<tr>
<td  valign="top">db.linlin.insert({&#8216;name':&#8217;foobar&#8217;,&#8217;age':25})</td>
<td  valign="top">insert into linlin (&#8216;name&#8217;,&#8217;age&#8217;) values(&#8216;foobar&#8217;,25)</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({})</td>
<td  valign="top">delete * from linlin</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':20})</td>
<td  valign="top">delete linlin where age=20</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':{$lt:20}})</td>
<td  valign="top">delete linlin where age&lt;20</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':{$lte:20}})</td>
<td  valign="top">delete linlin where age&lt;=20</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':{$gt:20}})</td>
<td  valign="top">delete linlin where age&gt;20</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':{$gte:20}})</td>
<td  valign="top">delete linlin where age&gt;=20</td>
</tr>
<tr>
<td  valign="top">db.linlin.remove({&#8216;age':{$ne:20}})</td>
<td  valign="top">delete linlin where age!=20</td>
</tr>
<tr>
<td  valign="top">db.linlin.update({&#8216;name':&#8217;foobar&#8217;},{$set:{&#8216;age':36}})</td>
<td  valign="top">update linlin set age=36 where name=&#8217;foobar&#8217;</td>
</tr>
<tr>
<td  valign="top">db.linlin.update({&#8216;name':&#8217;foobar&#8217;},{$inc:{&#8216;age':3}})</td>
<td  valign="top"> update linlin set age=age+3 where name=&#8217;foobar&#8217;</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/mongodb-grammar-database-operations-1273/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongodb 1.6与Mongodb 1.4并发性能对比</title>
		<link>https://www.fushanlang.com/mongodb-1-6-compared-with-concurrent-performance-mongodb-1-4-1267/</link>
		<comments>https://www.fushanlang.com/mongodb-1-6-compared-with-concurrent-performance-mongodb-1-4-1267/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 00:49:36 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Nosql]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=1267</guid>
		<description><![CDATA[<p>2010年8月5日，Mongodb 1.6正式发布了，这个版本增加和改进了很多功能，我了解的几个比较大的改进在：</p> <p> 1) Mongodb存储文件申请磁盘空间的方式做了改进。在mongodb  1.4的时候是按128M,256M,512M,1024M,2048M这样的方式申请磁盘空间的；而在mongodb  1.6中，已经是动态小量的申请磁盘空间了。</p> <p> 2) 增加了$or等查询操作符，这在mongodb 1.4的时候是没有的。</p> <p> 3) 改进和提高了并发性能。 </p> <p>4) Replication的同步方面做了改进。</p> <p> 5) etc&#8230; 详细的changelog可以看：http://jira.mongodb.org/browse/SERVER?report=com.atlassian.jira.plugin.system.project:changelog-panel</p> <p>在我发表这篇文章时，发现Mongodb 1.6.1也已经发布了，主要是修复了一些bug。居然说性能得到了提高，那么我们就对Mongodb 1.6和Mongodb 1.4分别做了一个性能测试，想对比下看看Mongodb 1.6性能到底比Mongodb 1.4提高了多少。测试机器为一台普通台式机，安装在64位centos linux 5.4系统。cpu为Intel E7500，内存为2G,单个普通500G硬盘。</p> <p> 测试程序每次测试都会insert 100万条记录（如10并发测试，每并发insert 10万条记录；20并发测试，每并发5万条记录&#8230;），每记录大小为1KB，然后再逐条update所有记录，最后逐条select出来。测试程序是在本机跑的，所以本次测试忽略网络延时。好，下面我们看测试结果：下面图中横轴10&#8230;100是指并发测试的并发线程。</p> <p style="text-align: center;"></p> <p>在insert测试内，Mongodb1.4和Mongodb1.6平分秋色，基本上没有区别。虽然在mongodb 1.6中对申请磁盘空间方式做了改进，但对性能的提升没有体现出来。随着并发的增加，性能快速下降的问题也没有得到改进。</p> <p style="text-align: center;"></p> <p>在update方面，性能提升显著，合计有75%的性能提高。而且表现平稳，随着并发的增加，性能稳定。非常不错。</p> <p style="text-align: center;"></p> <p>select方面表现也不错，合计有83%性能提高。在并发线程小时尤其明显。 通过上面几个方面测试的结果表明，Mongodb <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/mongodb-1-6-compared-with-concurrent-performance-mongodb-1-4-1267/">Mongodb 1.6与Mongodb 1.4并发性能对比</a></span>]]></description>
				<content:encoded><![CDATA[<p>2010年8月5日，<span class="highlight">Mongodb</span> 1.6正式发布了，这个版本增加和改进了很多功能，我了解的几个比较大的改进在：</p>
<p> 1) <span class="highlight">Mongodb</span>存储文件申请磁盘<span class="highlight">空间</span>的方式做了改进。在<span class="highlight">mongodb</span>  1.4的时候是按128M,256M,512M,1024M,2048M这样的方式申请磁盘<span class="highlight">空间</span>的；而在<span class="highlight">mongodb</span>  1.6中，已经是动态小量的申请磁盘<span class="highlight">空间</span>了。</p>
<p> 2) 增加了$or等查询操作符，这在<span class="highlight">mongodb</span> 1.4的时候是没有的。</p>
<p> 3) 改进和提高了并发性能。 <span id="more-1267"></span></p>
<p>4) Replication的同步方面做了改进。</p>
<p> 5) etc&#8230; 详细的changelog可以看：http://jira.<span class="highlight">mongodb</span>.org/browse/SERVER?report=com.atlassian.jira.plugin.system.project:changelog-panel</p>
<p>在我发表这篇文章时，发现<span class="highlight">Mongodb</span> 1.6.1也已经发布了，主要是修复了一些bug。居然说性能得到了提高，那么我们就对<span class="highlight">Mongodb</span> 1.6和<span class="highlight">Mongodb</span> 1.4分别做了一个性能测试，想对比下看看<span class="highlight">Mongodb</span> 1.6性能到底比<span class="highlight">Mongodb</span> 1.4提高了多少。测试机器为一台普通台式机，安装在64位centos linux 5.4系统。cpu为Intel E7500，内存为2G,单个普通500G硬盘。</p>
<p> 测试程序每次测试都会insert 100万条记录（如10并发测试，每并发insert 10万条记录；20并发测试，每并发5万条记录&#8230;），每记录大小为1KB，然后再逐条update所有记录，最后逐条select出来。测试程序是在本机跑的，所以本次测试忽略网络延时。好，下面我们看测试结果：下面图中横轴10&#8230;100是指并发测试的并发线程。</p>
<p style="text-align: center;"><img src="http://www.fushanlang.com/blog/wp-content/uploads/auto_save_image/2010/10/084938rTn.jpg" alt="Mongodb 1.6与Mongodb 1.4的并发性能对比" /></p>
<p>在insert测试内，<span class="highlight">Mongodb</span>1.4和<span class="highlight">Mongodb</span>1.6平分秋色，基本上没有区别。虽然在<span class="highlight">mongodb</span> 1.6中对申请磁盘<span class="highlight">空间</span>方式做了改进，但对性能的提升没有体现出来。随着并发的增加，性能快速下降的问题也没有得到改进。</p>
<p style="text-align: center;"><img src="http://www.fushanlang.com/blog/wp-content/uploads/auto_save_image/2010/10/084940xhX.jpg" alt="Mongodb 1.6与Mongodb 1.4的并发性能对比" /></p>
<p>在update方面，性能提升显著，合计有75%的性能提高。而且表现平稳，随着并发的增加，性能稳定。非常不错。</p>
<p style="text-align: center;"><img src="http://www.fushanlang.com/blog/wp-content/uploads/auto_save_image/2010/10/084941xNh.jpg" alt="Mongodb 1.6与Mongodb 1.4的并发性能对比" /></p>
<p>select方面表现也不错，合计有83%性能提高。在并发线程小时尤其明显。<br />
通过上面几个方面测试的结果表明，<span class="highlight">Mongodb</span> 1.6是还是非常值得我们升级的，不但增加了一些新功能，性能也得到了很大的提高。</p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/mongodb-1-6-compared-with-concurrent-performance-mongodb-1-4-1267/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install mongodb on bluehost</title>
		<link>https://www.fushanlang.com/install-the-mongodb-on-bluehost-413/</link>
		<comments>https://www.fushanlang.com/install-the-mongodb-on-bluehost-413/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 03:50:34 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Nosql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=413</guid>
		<description><![CDATA[<p>Oh,最近想在bluehost主机上安装MongoDB，于是google了一下，看到一篇博文（大意）：</p> <p>I want to install MongoDB on bluehost  recently. so I first  get some message from internet.</p> <p>logging in, I typed:</p> <p>uname -a</p> <p>And received affirmation that this is a 64bit server. Or you can typed:</p> <p>getconf   LONG_BIT</p> <p>It will return 64.</p> <p>Next, I went ahead and grabbed the current version from http://www.mongodb.org/downloads <span style="color:#777"> . . . &#8594; Read More: <a href="https://www.fushanlang.com/install-the-mongodb-on-bluehost-413/">Install mongodb on bluehost</a></span>]]></description>
				<content:encoded><![CDATA[<p>Oh,最近想在bluehost主机上安装MongoDB，于是google了一下，看到一篇博文（大意）：</p>
<p>I want to install MongoDB on bluehost  recently. so I first  get some message from internet.</p>
<p>logging in, I typed:</p>
<p><code>uname -a</code></p>
<p>And received affirmation that this is a 64bit server. Or you can typed:</p>
<p>getconf   LONG_BIT</p>
<p>It will return 64.</p>
<p>Next, I went ahead and grabbed the current version from <a href="http://www.mongodb.org/downloads">http://www.mongodb.org/downloads</a> by doing:</p>
<p><code>wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-static-legacy-1.6.1.tgz<br />
tar xzf mongodb-linux-x86_64-static-legacy-1.6.1.tgz <span id="more-413"></span><br />
</code></p>
<p>Change as necessary for the current version.  Then I ran the tests on the <a href="http://www.mongodb.org/display/DOCS/Quickstart+Unix#QuickstartUnix-Runandconnecttotheserver" target="_blank">quickstart page</a> of mongodb.org.  After I received confirmation that I successfully installed mongo, I headed over to their page about PHP driver…to quickly find out that installing <span style="color: #ff6600;">using </span><code><span style="color: #ff6600;">pecl</span></code><span style="color: #ff6600;"> does not work so well on bluehost</span>. The default extension_dir is set to read only.</p>
<p>So, I headed over to <a href="http://php.net/manual/en/mongo.installation.php" target="_blank">php.net’s mongo driver installation page</a>, and quickly looked at the manual installation instructions.  Following directions there was pretty easy and didn’t cause any problems until I go to the part about enabling the extension.  So, off to the php.ini file.  My favorite file of them all.</p>
<p>So, I do a quick search for the extension directory and take that information, and do a:</p>
<p><code>cp -r /usr/lib64/php/modules ~/php/modules</code></p>
<p>That copies all the modules in the default modules directory into a directory that I have some control over.  I then copied mongo.so from the installation directory into my new modules directory, and tada! everything is then working.</p>
<p>一开始，我就参照着弄了，但是phpinfo就是识别不了，今天终于想起来原来是extend_dir=~/php/modules 在php.ini里不识别应该改为完整的路径</p>
<p>extend_dir=&#8221;/home2/username/php/modules&#8221;</p>
<p>就Okay 了，真是一波三折，我还以为bluehost 不支持MongoDB，看来小看我可爱的BlueHost了。:)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This article is a little more up to date with the changes made by Hostmonster / Bluehost, and to make the instructions a little more clear, and simplified.</p>
<p>1. Download the MongoDB binaries – You want to download the  <strong>legacy-static</strong>  production release. Hosmonster / Bluehost run Linux 64-bit</p>
<p><a href="http://www.mongodb.org/downloads">Download</a></p>
<p>I found it easier to extract the files on my desktop then upload them to a directory called mongodb in the root home folder.</p>
<p>Your MongoDB folder should look like the below when all done:<br />
<strong>/home/{username}/mongodb</strong><br />
<strong>/home/{username}/mongodb/bin</strong><br />
<strong>/home/{username}/mongodb/data</strong><br />
<strong>/home/{username}/mongodb/include</strong><br />
<strong>/home/{username}/mongodb/lib64</strong></p>
<p>Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.</p>
<p>2. In your SSH/Shell console – Now we need to make the MongoDB command usable so do the following commands</p>
<p><strong>nano .bashrc</strong></p>
<p>3. Now add the following line to the bottom of the file.</p>
<p><strong>export PATH=/home/{username}/mongodb/bin:$PATH</strong></p>
<p>Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.</p>
<p>4. Save</p>
<p><strong>ctrl+x</strong>  confirm save by typing ‘Y’ then enter, then enter again to confirm the file.</p>
<p>5. Lets verify that everything is working. You will need to reload bash</p>
<p><strong>source .bashrc</strong></p>
<p>6. Make the MongoDB binaries executable</p>
<p><strong>chmod 744 -R mongodb/bin</strong></p>
<p>7. Verify MongoDB is running</p>
<p><strong>mongod —version</strong></p>
<p>8. Start the MongoDB</p>
<p><strong>screen mongod —dbpath /home/{username}/mongodb/data —quiet</strong></p>
<p>Now safe to exit your Shell Console</p>
<p>Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.</p>
<blockquote><p><strong>They only let you run a program for 5 minutes before killing it, so it’s fairly useless to install MongoDB unless you have a dedicated IP.</strong></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/install-the-mongodb-on-bluehost-413/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB与PHP</title>
		<link>https://www.fushanlang.com/the-mongodb-and-php-306/</link>
		<comments>https://www.fushanlang.com/the-mongodb-and-php-306/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 07:25:49 +0000</pubDate>
		<dc:creator><![CDATA[fushanlang]]></dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[编程]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.fushanlang.com/blog/?p=306</guid>
		<description><![CDATA[Windows PHP的MongoDB拓展的安装 <p>windows下用php操作MongoDB需要安装驱动，所需dll可以到http://github.com/mongodb/mongo-php-driver/downloads 下载。比如我的php版本是5.2.6，我下载的就是mongo-1.0.9-php5.2vc6ts.zip。</p> <p>把php_mongo.dll放到你php的ext目录，然后php.ini中加入</p> <p>extension=php_mongo.dll</p> <p>重启web服务器就可以了。是否成功可以通过查看phpinfo() 函数的结果中是否加载了MongoDB模块儿来判定。</p> <p>与mysql对应的php下数据库管理工具phpmyadmin类似，MongoDB下的php数据库管理工具为phpmoadmin可以到http://www.phpmoadmin.com/ 这里下载，放到你的web路径下就ok。</p> <p>现在你可以开始自己的php与MongoDB的开发之旅了。</p> <p>&#160;</p> Linux PHP的MongoDB拓展的安装 # wget http://pecl.php.net/get/mongo-1.2.6.tgz # tar zxvf mongo-1.2.6.tgz # cd mongo-1.2.6 # /usr/local/php/bin/phpize # ./configure &#8211;enable-mongo=share &#8211;with-php-config=/usr/local/php/bin/php-config # make &#38;&#38; make installl <p>将生成的拓展mongo.so文件添加到php.ini中，重启php-fpm，然后查看下phpinfo()</p> <p>请编辑php.ini文件。添加如下一行： </p> PHP Code复制内容到剪贴板 extension=mongo.so <p>然后用php输出:phpinfo，就可以看到mongo的信息了。。这样就说明你安装成功的了！</p> <p></p> ]]></description>
				<content:encoded><![CDATA[<h2>Windows PHP的MongoDB拓展的安装</h2>
<p>windows下用php操作MongoDB需要安装驱动，所需dll可以到<a class="wp-caption" href="http://github.com/mongodb/mongo-php-driver/downloads" target="_blank">http://github.com/mongodb/mongo-php-driver/downloads</a> 下载。比如我的php版本是5.2.6，我下载的就是<a href="http://github.com/downloads/mongodb/mongo-php-driver/mongo-1.0.9-php5.2vc6ts.zip">mongo-1.0.9-php5.2vc6ts.zip</a>。</p>
<p>把php_mongo.dll放到你php的ext目录，然后php.ini中加入</p>
<p>extension=php_mongo.dll</p>
<p>重启web服务器就可以了。是否成功可以通过查看phpinfo() 函数的结果中是否加载了MongoDB模块儿来判定。</p>
<p>与mysql对应的php下数据库管理工具phpmyadmin类似，MongoDB下的php数据库管理工具为phpmoadmin可以到<a class="wp-caption" href="http://www.phpmoadmin.com/" target="_blank">http://www.phpmoadmin.com/</a> 这里下载，放到你的web路径下就ok。</p>
<p>现在你可以开始自己的php与MongoDB的开发之旅了。</p>
<p>&nbsp;</p>
<h2>Linux PHP的MongoDB拓展的安装</h2>
<div>
<div id="code_4988">
<ol>
<li># wget http://pecl.php.net/get/mongo-1.2.6.tgz</li>
<li># tar zxvf mongo-1.2.6.tgz</li>
<li># cd mongo-1.2.6</li>
<li># /usr/local/php/bin/phpize</li>
<li># ./configure &#8211;enable-mongo=share &#8211;with-php-config=/usr/local/php/bin/php-config</li>
<li># make &amp;&amp; make installl</li>
</ol>
</div>
</div>
<p>将生成的拓展mongo.so文件添加到php.ini中，重启php-fpm，然后查看下phpinfo()</p>
<p><strong>请编辑php.ini文件。添加如下一行：<br />
</strong></p>
<div>
<div>PHP Code复制内容到剪贴板</div>
<div id="code_5285">
<ol>
<li>extension=mongo.so</li>
</ol>
</div>
</div>
<p>然后用php输出:phpinfo，就可以看到mongo的信息了。。这样就说明你安装成功的了！</p>
<p><img title="a" src="http://www.fushanlang.com/blog/wp-content/uploads/auto_save_image/2012/06/021945I4E.png" alt="&quot; width=" height="196" /></p>
]]></content:encoded>
			<wfw:commentRss>https://www.fushanlang.com/the-mongodb-and-php-306/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.150 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2025-12-17 17:14:22 -->
