Browse files

Site updated at 2013-03-17 02:55:52 UTC

  • Loading branch information...
1 parent a106747 commit a75d39f87a00436b39d8dcfa746567e4038338a3 utopia.zh@gmail.com committed Mar 17, 2013
View
71 atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Coding For Fun]]></title>
<link href="http://utopiazh.github.com/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
@@ -14,6 +14,75 @@
<entry>
+ <title type="html"><![CDATA[Configure Sharded MongoDB on single host]]></title>
+ <link href="http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host/"/>
+ <updated>2013-03-17T10:54:00+08:00</updated>
+ <id>http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host</id>
+ <content type="html"><![CDATA[<h1>Configure Sharded MongoDB on single host</h1>
+
+<p>The default configuration of mongodb only use a single thread, which will be
+bottleneck.</p>
+
+<h2>Config and Start mongodb</h2>
+
+<p>Start 3 config server</p>
+
+<pre><code>mongod --configsvr --dbpath /var/lib/mongodb/configdb/27019 --port 27019 --logpath /var/log/mongodb/mongod-27019.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27119 --port 27119 --logpath /var/log/mongodb/mongod-27119.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27219 --port 27219 --logpath /var/log/mongodb/mongod-27219.log --logappend &amp;
+</code></pre>
+
+<p>Start 3 data server</p>
+
+<pre><code>mongod --dbpath /var/lib/mongodb/datadb/27029 --port 27029 --logpath /var/log/mongodb/mongod-27029.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27129 --port 27129 --logpath /var/log/mongodb/mongod-27129.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27229 --port 27229 --logpath /var/log/mongodb/mongod-27229.log --logappend &amp;
+</code></pre>
+
+<p>Start mongos server</p>
+
+<pre><code>mongos --configdb 127.0.0.1:27019,127.0.0.1:27119,127.0.0.1:27219 --port 27017 --logpath /var/log/mongodb/mongos-27017.log --logappend &amp;
+</code></pre>
+
+<h2>Add shard for standalone mongod</h2>
+
+<p>Connect to mongos</p>
+
+<pre><code># mongo
+MongoDB shell version: 2.0.6
+connecting to: test
+mongos&gt; sh.addShard("127.0.0.1:27029")
+mongos&gt; sh.addShard("127.0.0.1:27129")
+mongos&gt; sh.addShard("127.0.0.1:27229")
+</code></pre>
+
+<p>Enable shard for DB</p>
+
+<p> mongos> sh.enableSharding(&#8220;github&#8221;)</p>
+
+<p>Create Index on the to-be-sharded key</p>
+
+<pre><code>mongos&gt; use github
+mongos&gt; db.repos.ensureIndex({"id" :1})
+</code></pre>
+
+<p>Enable shard for collection</p>
+
+<pre><code>mongos&gt; sh.shardCollection("github.repos", {"id": 1})
+</code></pre>
+]]></content>
+ </entry>
+
+ <entry>
+ <title type="html"><![CDATA[CodeReading: SolrCloud - Sharding]]></title>
+ <link href="http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding/"/>
+ <updated>2013-03-10T21:20:00+08:00</updated>
+ <id>http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding</id>
+ <content type="html"><![CDATA[<h1>Working in progress</h1>
+]]></content>
+ </entry>
+
+ <entry>
<title type="html"><![CDATA[Notes:Practical Machine Learning in Python]]></title>
<link href="http://utopiazh.github.com/blog/2013/03/10/notes-practical-machine-learning-in-python/"/>
<updated>2013-03-10T18:54:00+08:00</updated>
View
12 blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/index.html
@@ -285,19 +285,23 @@ <h1 class="entry-title">How to Use Octopress and Github to Write Blog</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
261 blog/2013/03/10/codereading-solrcloud-sharding/index.html
@@ -0,0 +1,261 @@
+
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>CodeReading: SolrCloud - Sharding - Coding For Fun</title>
+ <meta name="author" content="Hang Zhou">
+
+
+ <meta name="description" content="Working in progress
+">
+
+
+ <!-- http://t.co/dKP3o1e -->
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+
+ <link rel="canonical" href="http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding/">
+ <link href="/favicon.png" rel="icon">
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
+ <script src="/javascripts/modernizr-2.0.js"></script>
+ <script src="/javascripts/ender.js"></script>
+ <script src="/javascripts/octopress.js" type="text/javascript"></script>
+ <link href="/atom.xml" rel="alternate" title="Coding For Fun" type="application/atom+xml">
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
+<!--
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+-->
+
+
+
+</head>
+
+<body >
+ <header role="banner"><hgroup>
+ <h1><a href="/">Coding For Fun</a></h1>
+
+ <h2>March 20 miles every day</h2>
+
+</hgroup>
+
+</header>
+ <nav role="navigation"><ul class="subscription" data-subscription="rss">
+ <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
+
+</ul>
+
+<form action="http://google.com/search" method="get">
+ <fieldset role="search">
+ <input type="hidden" name="q" value="site:utopiazh.github.com" />
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
+ </fieldset>
+</form>
+
+<ul class="main-navigation">
+ <li><a href="/">Blog</a></li>
+ <li><a href="/blog/archives">Archives</a></li>
+</ul>
+
+</nav>
+ <div id="main">
+ <div id="content">
+ <div>
+<article class="hentry" role="article">
+
+ <header>
+
+ <h1 class="entry-title">CodeReading: SolrCloud - Sharding</h1>
+
+
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-10T21:20:00+08:00" pubdate data-updated="true">Mar 10<span>th</span>, 2013</time>
+
+ </p>
+
+ </header>
+
+
+<div class="entry-content"><h1>Working in progress</h1>
+</div>
+
+
+ <footer>
+ <p class="meta">
+
+
+
+<span class="byline author vcard">Posted by <span class="fn">Hang Zhou</span></span>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-10T21:20:00+08:00" pubdate data-updated="true">Mar 10<span>th</span>, 2013</time>
+
+
+<span class="categories">
+
+ <a class='category' href='/blog/categories/search/'>search</a>
+
+</span>
+
+
+ </p>
+
+ <div class="sharing">
+
+
+
+
+ <!-- JiaThis Button BEGIN -->
+<div class="jiathis_style">
+ <a class="jiathis_button_qzone"></a>
+ <a class="jiathis_button_tsina"></a>
+ <a class="jiathis_button_tqq"></a>
+ <a class="jiathis_button_renren"></a>
+ <a class="jiathis_button_kaixin001"></a>
+ <a href="http://www.jiathis.com/share"
+ class="jiathis jiathis_txt jtico
+ jtico_jiathis" target="_blank"></a>
+ <a class="jiathis_counter_style"></a>
+</div>
+<script type="text/javascript"
+ src="http://v3.jiathis.com/code/jia.js?uid=1358053663737765"
+ charset="utf-8"></script>
+<!-- JiaThis Button END -->
+
+<!-- UY BEGIN -->
+<div id="uyan_frame"></div>
+<script type="text/javascript" id="UYScript"
+ src="http://v1.uyan.cc/js/iframe.js?UYUserId=1731955" async=""></script>
+<!-- UY END -->
+
+
+
+</div>
+
+
+ <p class="meta">
+
+ <a class="basic-alignment left" href="/blog/2013/03/10/notes-practical-machine-learning-in-python/" title="Previous Post: Notes:Practical Machine Learning in Python">&laquo; Notes:Practical Machine Learning in Python</a>
+
+
+ <a class="basic-alignment right" href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/" title="Next Post: Configure Sharded MongoDB on single host">Configure Sharded MongoDB on single host &raquo;</a>
+
+ </p>
+ </footer>
+</article>
+
+</div>
+
+<aside class="sidebar">
+
+ <section>
+ <h1>Recent Posts</h1>
+ <ul id="recent_posts">
+
+ <li class="post">
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ </li>
+
+ </ul>
+</section>
+
+<section>
+ <h1>GitHub Repos</h1>
+ <ul id="gh_repos">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <a href="https://github.com/utopiazh">@utopiazh</a> on GitHub
+
+ <script type="text/javascript">
+ $.domReady(function(){
+ if (!window.jXHR){
+ var jxhr = document.createElement('script');
+ jxhr.type = 'text/javascript';
+ jxhr.src = '/javascripts/libs/jXHR.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(jxhr, s);
+ }
+
+ github.showRepos({
+ user: 'utopiazh',
+ count: 3,
+ skip_forks: true,
+ target: '#gh_repos'
+ });
+ });
+ </script>
+ <script src="/javascripts/github.js" type="text/javascript"> </script>
+</section>
+
+
+
+</aside>
+
+
+ </div>
+ </div>
+ <footer role="contentinfo"><p>
+ Copyright &copy; 2013 - Hang Zhou -
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
+</p>
+
+</footer>
+
+
+
+
+
+
+
+
+
+
+
+
+</body>
+</html>
View
12 blog/2013/03/10/configure-ubuntu-with-dual-monitor/index.html
@@ -225,19 +225,23 @@ <h1 class="entry-title">Configure Ubuntu With Dual Monitor</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
12 blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/index.html
@@ -277,19 +277,23 @@ <h1 class="entry-title">Multi-tenant of HBase in FaceBook</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
14 blog/2013/03/10/notes-practical-machine-learning-in-python/index.html
@@ -269,6 +269,8 @@ <h1 class="entry-title">Notes:Practical Machine Learning in Python</h1>
<a class="basic-alignment left" href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/" title="Previous Post: Multi-tenant of HBase in FaceBook">&laquo; Multi-tenant of HBase in FaceBook</a>
+ <a class="basic-alignment right" href="/blog/2013/03/10/codereading-solrcloud-sharding/" title="Next Post: CodeReading: SolrCloud - Sharding">CodeReading: SolrCloud - Sharding &raquo;</a>
+
</p>
</footer>
</article>
@@ -282,19 +284,23 @@ <h1 class="entry-title">Notes:Practical Machine Learning in Python</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
310 blog/2013/03/17/configure-sharded-mongodb-on-single-host/index.html
@@ -0,0 +1,310 @@
+
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>Configure Sharded MongoDB on single host - Coding For Fun</title>
+ <meta name="author" content="Hang Zhou">
+
+
+ <meta name="description" content="Configure Sharded MongoDB on single host The default configuration of mongodb only use a single thread, which will be
+bottleneck. Config and Start &hellip;">
+
+
+ <!-- http://t.co/dKP3o1e -->
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+
+ <link rel="canonical" href="http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">
+ <link href="/favicon.png" rel="icon">
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
+ <script src="/javascripts/modernizr-2.0.js"></script>
+ <script src="/javascripts/ender.js"></script>
+ <script src="/javascripts/octopress.js" type="text/javascript"></script>
+ <link href="/atom.xml" rel="alternate" title="Coding For Fun" type="application/atom+xml">
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
+<!--
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+-->
+
+
+
+</head>
+
+<body >
+ <header role="banner"><hgroup>
+ <h1><a href="/">Coding For Fun</a></h1>
+
+ <h2>March 20 miles every day</h2>
+
+</hgroup>
+
+</header>
+ <nav role="navigation"><ul class="subscription" data-subscription="rss">
+ <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
+
+</ul>
+
+<form action="http://google.com/search" method="get">
+ <fieldset role="search">
+ <input type="hidden" name="q" value="site:utopiazh.github.com" />
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
+ </fieldset>
+</form>
+
+<ul class="main-navigation">
+ <li><a href="/">Blog</a></li>
+ <li><a href="/blog/archives">Archives</a></li>
+</ul>
+
+</nav>
+ <div id="main">
+ <div id="content">
+ <div>
+<article class="hentry" role="article">
+
+ <header>
+
+ <h1 class="entry-title">Configure Sharded MongoDB on Single Host</h1>
+
+
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-17T10:54:00+08:00" pubdate data-updated="true">Mar 17<span>th</span>, 2013</time>
+
+ </p>
+
+ </header>
+
+
+<div class="entry-content"><h1>Configure Sharded MongoDB on single host</h1>
+
+<p>The default configuration of mongodb only use a single thread, which will be
+bottleneck.</p>
+
+<h2>Config and Start mongodb</h2>
+
+<p>Start 3 config server</p>
+
+<pre><code>mongod --configsvr --dbpath /var/lib/mongodb/configdb/27019 --port 27019 --logpath /var/log/mongodb/mongod-27019.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27119 --port 27119 --logpath /var/log/mongodb/mongod-27119.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27219 --port 27219 --logpath /var/log/mongodb/mongod-27219.log --logappend &amp;
+</code></pre>
+
+<p>Start 3 data server</p>
+
+<pre><code>mongod --dbpath /var/lib/mongodb/datadb/27029 --port 27029 --logpath /var/log/mongodb/mongod-27029.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27129 --port 27129 --logpath /var/log/mongodb/mongod-27129.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27229 --port 27229 --logpath /var/log/mongodb/mongod-27229.log --logappend &amp;
+</code></pre>
+
+<p>Start mongos server</p>
+
+<pre><code>mongos --configdb 127.0.0.1:27019,127.0.0.1:27119,127.0.0.1:27219 --port 27017 --logpath /var/log/mongodb/mongos-27017.log --logappend &amp;
+</code></pre>
+
+<h2>Add shard for standalone mongod</h2>
+
+<p>Connect to mongos</p>
+
+<pre><code># mongo
+MongoDB shell version: 2.0.6
+connecting to: test
+mongos&gt; sh.addShard("127.0.0.1:27029")
+mongos&gt; sh.addShard("127.0.0.1:27129")
+mongos&gt; sh.addShard("127.0.0.1:27229")
+</code></pre>
+
+<p>Enable shard for DB</p>
+
+<p> mongos> sh.enableSharding(&#8220;github&#8221;)</p>
+
+<p>Create Index on the to-be-sharded key</p>
+
+<pre><code>mongos&gt; use github
+mongos&gt; db.repos.ensureIndex({"id" :1})
+</code></pre>
+
+<p>Enable shard for collection</p>
+
+<pre><code>mongos&gt; sh.shardCollection("github.repos", {"id": 1})
+</code></pre>
+</div>
+
+
+ <footer>
+ <p class="meta">
+
+
+
+<span class="byline author vcard">Posted by <span class="fn">Hang Zhou</span></span>
+
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-17T10:54:00+08:00" pubdate data-updated="true">Mar 17<span>th</span>, 2013</time>
+
+
+<span class="categories">
+
+ <a class='category' href='/blog/categories/mongodb/'>mongodb</a>
+
+</span>
+
+
+ </p>
+
+ <div class="sharing">
+
+
+
+
+ <!-- JiaThis Button BEGIN -->
+<div class="jiathis_style">
+ <a class="jiathis_button_qzone"></a>
+ <a class="jiathis_button_tsina"></a>
+ <a class="jiathis_button_tqq"></a>
+ <a class="jiathis_button_renren"></a>
+ <a class="jiathis_button_kaixin001"></a>
+ <a href="http://www.jiathis.com/share"
+ class="jiathis jiathis_txt jtico
+ jtico_jiathis" target="_blank"></a>
+ <a class="jiathis_counter_style"></a>
+</div>
+<script type="text/javascript"
+ src="http://v3.jiathis.com/code/jia.js?uid=1358053663737765"
+ charset="utf-8"></script>
+<!-- JiaThis Button END -->
+
+<!-- UY BEGIN -->
+<div id="uyan_frame"></div>
+<script type="text/javascript" id="UYScript"
+ src="http://v1.uyan.cc/js/iframe.js?UYUserId=1731955" async=""></script>
+<!-- UY END -->
+
+
+
+</div>
+
+
+ <p class="meta">
+
+ <a class="basic-alignment left" href="/blog/2013/03/10/codereading-solrcloud-sharding/" title="Previous Post: CodeReading: SolrCloud - Sharding">&laquo; CodeReading: SolrCloud - Sharding</a>
+
+
+ </p>
+ </footer>
+</article>
+
+</div>
+
+<aside class="sidebar">
+
+ <section>
+ <h1>Recent Posts</h1>
+ <ul id="recent_posts">
+
+ <li class="post">
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ </li>
+
+ </ul>
+</section>
+
+<section>
+ <h1>GitHub Repos</h1>
+ <ul id="gh_repos">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <a href="https://github.com/utopiazh">@utopiazh</a> on GitHub
+
+ <script type="text/javascript">
+ $.domReady(function(){
+ if (!window.jXHR){
+ var jxhr = document.createElement('script');
+ jxhr.type = 'text/javascript';
+ jxhr.src = '/javascripts/libs/jXHR.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(jxhr, s);
+ }
+
+ github.showRepos({
+ user: 'utopiazh',
+ count: 3,
+ skip_forks: true,
+ target: '#gh_repos'
+ });
+ });
+ </script>
+ <script src="/javascripts/github.js" type="text/javascript"> </script>
+</section>
+
+
+
+</aside>
+
+
+ </div>
+ </div>
+ <footer role="contentinfo"><p>
+ Copyright &copy; 2013 - Hang Zhou -
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
+</p>
+
+</footer>
+
+
+
+
+
+
+
+
+
+
+
+
+</body>
+</html>
View
46 blog/archives/index.html
@@ -9,9 +9,9 @@
<meta name="author" content="Hang Zhou">
- <meta name="description" content="Blog Archive 2013 Notes:Practical Machine Learning in Python
-Mar 10 2013 posted in machinelearning Multi-tenant of HBase in FaceBook
-Mar 10 2013 &hellip;">
+ <meta name="description" content="Blog Archive 2013 Configure Sharded MongoDB on single host
+Mar 17 2013 posted in mongodb CodeReading: SolrCloud - Sharding
+Mar 10 2013 posted in &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -83,6 +83,34 @@ <h1 class="entry-title">Blog Archive</h1>
<article>
+<h1><a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a></h1>
+<time datetime="2013-03-17T10:54:00+08:00" pubdate><span class='month'>Mar</span> <span class='day'>17</span> <span class='year'>2013</span></time>
+
+<footer>
+ <span class="categories">posted in <a class='category' href='/blog/categories/mongodb/'>mongodb</a></span>
+</footer>
+
+
+</article>
+
+
+
+<article>
+
+<h1><a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a></h1>
+<time datetime="2013-03-10T21:20:00+08:00" pubdate><span class='month'>Mar</span> <span class='day'>10</span> <span class='year'>2013</span></time>
+
+<footer>
+ <span class="categories">posted in <a class='category' href='/blog/categories/search/'>search</a></span>
+</footer>
+
+
+</article>
+
+
+
+<article>
+
<h1><a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a></h1>
<time datetime="2013-03-10T18:54:00+08:00" pubdate><span class='month'>Mar</span> <span class='day'>10</span> <span class='year'>2013</span></time>
@@ -149,19 +177,23 @@ <h1 class="entry-title">Blog Archive</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
2 blog/categories/hadoop/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: hadoop | Coding For Fun]]></title>
<link href="http://utopiazh.github.com/blog/categories/hadoop/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
View
12 blog/categories/hadoop/index.html
@@ -105,19 +105,23 @@ <h1 class="entry-title">Category: Hadoop</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
2 blog/categories/hbase/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: hbase, | Coding For Fun]]></title>
<link href="http://utopiazh.github.com/blog/categories/hbase/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
View
12 blog/categories/hbase/index.html
@@ -105,19 +105,23 @@ <h1 class="entry-title">Category: Hbase,</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
2 blog/categories/linux/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: linux | Coding For Fun]]></title>
<link href="http://utopiazh.github.com/blog/categories/linux/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
View
12 blog/categories/linux/index.html
@@ -105,19 +105,23 @@ <h1 class="entry-title">Category: Linux</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
2 blog/categories/machinelearning/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: machinelearning | Coding For Fun]]></title>
<link href="http://utopiazh.github.com/blog/categories/machinelearning/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
View
12 blog/categories/machinelearning/index.html
@@ -105,19 +105,23 @@ <h1 class="entry-title">Category: Machinelearning</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
76 blog/categories/mongodb/atom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title><![CDATA[Category: mongodb | Coding For Fun]]></title>
+ <link href="http://utopiazh.github.com/blog/categories/mongodb/atom.xml" rel="self"/>
+ <link href="http://utopiazh.github.com/"/>
+ <updated>2013-03-17T10:55:50+08:00</updated>
+ <id>http://utopiazh.github.com/</id>
+ <author>
+ <name><![CDATA[Hang Zhou]]></name>
+
+ </author>
+ <generator uri="http://octopress.org/">Octopress</generator>
+
+
+ <entry>
+ <title type="html"><![CDATA[Configure Sharded MongoDB on single host]]></title>
+ <link href="http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host/"/>
+ <updated>2013-03-17T10:54:00+08:00</updated>
+ <id>http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host</id>
+ <content type="html"><![CDATA[<h1>Configure Sharded MongoDB on single host</h1>
+
+<p>The default configuration of mongodb only use a single thread, which will be
+bottleneck.</p>
+
+<h2>Config and Start mongodb</h2>
+
+<p>Start 3 config server</p>
+
+<pre><code>mongod --configsvr --dbpath /var/lib/mongodb/configdb/27019 --port 27019 --logpath /var/log/mongodb/mongod-27019.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27119 --port 27119 --logpath /var/log/mongodb/mongod-27119.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27219 --port 27219 --logpath /var/log/mongodb/mongod-27219.log --logappend &amp;
+</code></pre>
+
+<p>Start 3 data server</p>
+
+<pre><code>mongod --dbpath /var/lib/mongodb/datadb/27029 --port 27029 --logpath /var/log/mongodb/mongod-27029.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27129 --port 27129 --logpath /var/log/mongodb/mongod-27129.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27229 --port 27229 --logpath /var/log/mongodb/mongod-27229.log --logappend &amp;
+</code></pre>
+
+<p>Start mongos server</p>
+
+<pre><code>mongos --configdb 127.0.0.1:27019,127.0.0.1:27119,127.0.0.1:27219 --port 27017 --logpath /var/log/mongodb/mongos-27017.log --logappend &amp;
+</code></pre>
+
+<h2>Add shard for standalone mongod</h2>
+
+<p>Connect to mongos</p>
+
+<pre><code># mongo
+MongoDB shell version: 2.0.6
+connecting to: test
+mongos&gt; sh.addShard("127.0.0.1:27029")
+mongos&gt; sh.addShard("127.0.0.1:27129")
+mongos&gt; sh.addShard("127.0.0.1:27229")
+</code></pre>
+
+<p>Enable shard for DB</p>
+
+<p> mongos> sh.enableSharding("github")</p>
+
+<p>Create Index on the to-be-sharded key</p>
+
+<pre><code>mongos&gt; use github
+mongos&gt; db.repos.ensureIndex({"id" :1})
+</code></pre>
+
+<p>Enable shard for collection</p>
+
+<pre><code>mongos&gt; sh.shardCollection("github.repos", {"id": 1})
+</code></pre>
+]]></content>
+ </entry>
+
+</feed>
View
185 blog/categories/mongodb/index.html
@@ -0,0 +1,185 @@
+
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>Category: mongodb - Coding For Fun</title>
+ <meta name="author" content="Hang Zhou">
+
+
+ <meta name="description" content="Category: mongodb">
+
+
+ <!-- http://t.co/dKP3o1e -->
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+
+ <link rel="canonical" href="http://utopiazh.github.comblog/categories/mongodb/">
+ <link href="/favicon.png" rel="icon">
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
+ <script src="/javascripts/modernizr-2.0.js"></script>
+ <script src="/javascripts/ender.js"></script>
+ <script src="/javascripts/octopress.js" type="text/javascript"></script>
+ <link href="/atom.xml" rel="alternate" title="Coding For Fun" type="application/atom+xml">
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
+<!--
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+-->
+
+
+
+</head>
+
+<body >
+ <header role="banner"><hgroup>
+ <h1><a href="/">Coding For Fun</a></h1>
+
+ <h2>March 20 miles every day</h2>
+
+</hgroup>
+
+</header>
+ <nav role="navigation"><ul class="subscription" data-subscription="rss">
+ <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
+
+</ul>
+
+<form action="http://google.com/search" method="get">
+ <fieldset role="search">
+ <input type="hidden" name="q" value="site:utopiazh.github.com" />
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
+ </fieldset>
+</form>
+
+<ul class="main-navigation">
+ <li><a href="/">Blog</a></li>
+ <li><a href="/blog/archives">Archives</a></li>
+</ul>
+
+</nav>
+ <div id="main">
+ <div id="content">
+ <div>
+<article role="article">
+
+ <header>
+ <h1 class="entry-title">Category: Mongodb</h1>
+
+ </header>
+
+ <div id="blog-archives" class="category">
+
+
+
+
+ <h2>2013</h2>
+
+<article>
+
+<h1><a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a></h1>
+<time datetime="2013-03-17T10:54:00+08:00" pubdate><span class='month'>Mar</span> <span class='day'>17</span> <span class='year'>2013</span></time>
+
+<footer>
+ <span class="categories">posted in <a class='category' href='/blog/categories/mongodb/'>mongodb</a></span>
+</footer>
+
+
+</article>
+
+</div>
+
+
+</article>
+
+</div>
+
+<aside class="sidebar">
+
+ <section>
+ <h1>Recent Posts</h1>
+ <ul id="recent_posts">
+
+ <li class="post">
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ </li>
+
+ </ul>
+</section>
+
+<section>
+ <h1>GitHub Repos</h1>
+ <ul id="gh_repos">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <a href="https://github.com/utopiazh">@utopiazh</a> on GitHub
+
+ <script type="text/javascript">
+ $.domReady(function(){
+ if (!window.jXHR){
+ var jxhr = document.createElement('script');
+ jxhr.type = 'text/javascript';
+ jxhr.src = '/javascripts/libs/jXHR.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(jxhr, s);
+ }
+
+ github.showRepos({
+ user: 'utopiazh',
+ count: 3,
+ skip_forks: true,
+ target: '#gh_repos'
+ });
+ });
+ </script>
+ <script src="/javascripts/github.js" type="text/javascript"> </script>
+</section>
+
+
+
+</aside>
+
+
+ </div>
+ </div>
+ <footer role="contentinfo"><p>
+ Copyright &copy; 2013 - Hang Zhou -
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
+</p>
+
+</footer>
+
+
+
+
+
+
+
+
+
+
+
+
+</body>
+</html>
View
25 blog/categories/search/atom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title><![CDATA[Category: search | Coding For Fun]]></title>
+ <link href="http://utopiazh.github.com/blog/categories/search/atom.xml" rel="self"/>
+ <link href="http://utopiazh.github.com/"/>
+ <updated>2013-03-17T10:55:50+08:00</updated>
+ <id>http://utopiazh.github.com/</id>
+ <author>
+ <name><![CDATA[Hang Zhou]]></name>
+
+ </author>
+ <generator uri="http://octopress.org/">Octopress</generator>
+
+
+ <entry>
+ <title type="html"><![CDATA[CodeReading: SolrCloud - Sharding]]></title>
+ <link href="http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding/"/>
+ <updated>2013-03-10T21:20:00+08:00</updated>
+ <id>http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding</id>
+ <content type="html"><![CDATA[<h1>Working in progress</h1>
+]]></content>
+ </entry>
+
+</feed>
View
185 blog/categories/search/index.html
@@ -0,0 +1,185 @@
+
+<!DOCTYPE html>
+<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
+<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
+<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <title>Category: search - Coding For Fun</title>
+ <meta name="author" content="Hang Zhou">
+
+
+ <meta name="description" content="Category: search">
+
+
+ <!-- http://t.co/dKP3o1e -->
+ <meta name="HandheldFriendly" content="True">
+ <meta name="MobileOptimized" content="320">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+
+ <link rel="canonical" href="http://utopiazh.github.comblog/categories/search/">
+ <link href="/favicon.png" rel="icon">
+ <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
+ <script src="/javascripts/modernizr-2.0.js"></script>
+ <script src="/javascripts/ender.js"></script>
+ <script src="/javascripts/octopress.js" type="text/javascript"></script>
+ <link href="/atom.xml" rel="alternate" title="Coding For Fun" type="application/atom+xml">
+ <!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
+<!--
+<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
+-->
+
+
+
+</head>
+
+<body >
+ <header role="banner"><hgroup>
+ <h1><a href="/">Coding For Fun</a></h1>
+
+ <h2>March 20 miles every day</h2>
+
+</hgroup>
+
+</header>
+ <nav role="navigation"><ul class="subscription" data-subscription="rss">
+ <li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
+
+</ul>
+
+<form action="http://google.com/search" method="get">
+ <fieldset role="search">
+ <input type="hidden" name="q" value="site:utopiazh.github.com" />
+ <input class="search" type="text" name="q" results="0" placeholder="Search"/>
+ </fieldset>
+</form>
+
+<ul class="main-navigation">
+ <li><a href="/">Blog</a></li>
+ <li><a href="/blog/archives">Archives</a></li>
+</ul>
+
+</nav>
+ <div id="main">
+ <div id="content">
+ <div>
+<article role="article">
+
+ <header>
+ <h1 class="entry-title">Category: Search</h1>
+
+ </header>
+
+ <div id="blog-archives" class="category">
+
+
+
+
+ <h2>2013</h2>
+
+<article>
+
+<h1><a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a></h1>
+<time datetime="2013-03-10T21:20:00+08:00" pubdate><span class='month'>Mar</span> <span class='day'>10</span> <span class='year'>2013</span></time>
+
+<footer>
+ <span class="categories">posted in <a class='category' href='/blog/categories/search/'>search</a></span>
+</footer>
+
+
+</article>
+
+</div>
+
+
+</article>
+
+</div>
+
+<aside class="sidebar">
+
+ <section>
+ <h1>Recent Posts</h1>
+ <ul id="recent_posts">
+
+ <li class="post">
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ </li>
+
+ </ul>
+</section>
+
+<section>
+ <h1>GitHub Repos</h1>
+ <ul id="gh_repos">
+ <li class="loading">Status updating...</li>
+ </ul>
+
+ <a href="https://github.com/utopiazh">@utopiazh</a> on GitHub
+
+ <script type="text/javascript">
+ $.domReady(function(){
+ if (!window.jXHR){
+ var jxhr = document.createElement('script');
+ jxhr.type = 'text/javascript';
+ jxhr.src = '/javascripts/libs/jXHR.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(jxhr, s);
+ }
+
+ github.showRepos({
+ user: 'utopiazh',
+ count: 3,
+ skip_forks: true,
+ target: '#gh_repos'
+ });
+ });
+ </script>
+ <script src="/javascripts/github.js" type="text/javascript"> </script>
+</section>
+
+
+
+</aside>
+
+
+ </div>
+ </div>
+ <footer role="contentinfo"><p>
+ Copyright &copy; 2013 - Hang Zhou -
+ <span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
+</p>
+
+</footer>
+
+
+
+
+
+
+
+
+
+
+
+
+</body>
+</html>
View
2 blog/categories/tools/atom.xml
@@ -4,7 +4,7 @@
<title><![CDATA[Category: tools | Coding For Fun]]></title>
<link href="http://utopiazh.github.com/blog/categories/tools/atom.xml" rel="self"/>
<link href="http://utopiazh.github.com/"/>
- <updated>2013-03-10T21:15:08+08:00</updated>
+ <updated>2013-03-17T10:55:50+08:00</updated>
<id>http://utopiazh.github.com/</id>
<author>
<name><![CDATA[Hang Zhou]]></name>
View
12 blog/categories/tools/index.html
@@ -105,19 +105,23 @@ <h1 class="entry-title">Category: Tools</h1>
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
139 index.html
@@ -9,8 +9,8 @@
<meta name="author" content="Hang Zhou">
- <meta name="description" content="Notes for video Practical Machine Learning in
-Python. Example: Home-runs and strikeouts predicting Questions: What features are strong predicators &hellip;">
+ <meta name="description" content="Configure Sharded MongoDB on single host The default configuration of mongodb only use a single thread, which will be
+bottleneck. Config and Start &hellip;">
<!-- http://t.co/dKP3o1e -->
@@ -73,6 +73,129 @@
<header>
+ <h1 class="entry-title"><a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on Single Host</a></h1>
+
+
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-17T10:54:00+08:00" pubdate data-updated="true">Mar 17<span>th</span>, 2013</time>
+
+ </p>
+
+ </header>
+
+
+ <div class="entry-content"><h1>Configure Sharded MongoDB on single host</h1>
+
+<p>The default configuration of mongodb only use a single thread, which will be
+bottleneck.</p>
+
+<h2>Config and Start mongodb</h2>
+
+<p>Start 3 config server</p>
+
+<pre><code>mongod --configsvr --dbpath /var/lib/mongodb/configdb/27019 --port 27019 --logpath /var/log/mongodb/mongod-27019.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27119 --port 27119 --logpath /var/log/mongodb/mongod-27119.log --logappend &amp;
+mongod --configsvr --dbpath /var/lib/mongodb/configdb/27219 --port 27219 --logpath /var/log/mongodb/mongod-27219.log --logappend &amp;
+</code></pre>
+
+<p>Start 3 data server</p>
+
+<pre><code>mongod --dbpath /var/lib/mongodb/datadb/27029 --port 27029 --logpath /var/log/mongodb/mongod-27029.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27129 --port 27129 --logpath /var/log/mongodb/mongod-27129.log --logappend &amp;
+mongod --dbpath /var/lib/mongodb/datadb/27229 --port 27229 --logpath /var/log/mongodb/mongod-27229.log --logappend &amp;
+</code></pre>
+
+<p>Start mongos server</p>
+
+<pre><code>mongos --configdb 127.0.0.1:27019,127.0.0.1:27119,127.0.0.1:27219 --port 27017 --logpath /var/log/mongodb/mongos-27017.log --logappend &amp;
+</code></pre>
+
+<h2>Add shard for standalone mongod</h2>
+
+<p>Connect to mongos</p>
+
+<pre><code># mongo
+MongoDB shell version: 2.0.6
+connecting to: test
+mongos&gt; sh.addShard("127.0.0.1:27029")
+mongos&gt; sh.addShard("127.0.0.1:27129")
+mongos&gt; sh.addShard("127.0.0.1:27229")
+</code></pre>
+
+<p>Enable shard for DB</p>
+
+<p> mongos> sh.enableSharding(&#8220;github&#8221;)</p>
+
+<p>Create Index on the to-be-sharded key</p>
+
+<pre><code>mongos&gt; use github
+mongos&gt; db.repos.ensureIndex({"id" :1})
+</code></pre>
+
+<p>Enable shard for collection</p>
+
+<pre><code>mongos&gt; sh.shardCollection("github.repos", {"id": 1})
+</code></pre>
+</div>
+
+
+
+
+ </article>
+
+
+ <article>
+
+ <header>
+
+ <h1 class="entry-title"><a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a></h1>
+
+
+ <p class="meta">
+
+
+
+
+
+
+
+
+
+
+
+
+<time datetime="2013-03-10T21:20:00+08:00" pubdate data-updated="true">Mar 10<span>th</span>, 2013</time>
+
+ </p>
+
+ </header>
+
+
+ <div class="entry-content"><h1>Working in progress</h1>
+</div>
+
+
+
+
+ </article>
+
+
+ <article>
+
+ <header>
+
<h1 class="entry-title"><a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a></h1>
@@ -575,19 +698,23 @@ <h1 class="entry-title"><a href="/blog/2013/01/13/how-to-use-octopress-and-githu
<ul id="recent_posts">
<li class="post">
- <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ <a href="/blog/2013/03/17/configure-sharded-mongodb-on-single-host/">Configure Sharded MongoDB on single host</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
+ <a href="/blog/2013/03/10/codereading-solrcloud-sharding/">CodeReading: SolrCloud - Sharding</a>
</li>
<li class="post">
- <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
+ <a href="/blog/2013/03/10/notes-practical-machine-learning-in-python/">Notes:Practical Machine Learning in Python</a>
+ </li>
+
+ <li class="post">
+ <a href="/blog/2013/03/10/multi-tenancies-of-hbase-in-facebook/">Multi-tenant of HBase in FaceBook</a>
</li>
<li class="post">
- <a href="/blog/2013/01/13/how-to-use-octopress-and-github-to-write-blog/">How to use octopress and github to write blog</a>
+ <a href="/blog/2013/03/10/configure-ubuntu-with-dual-monitor/">Configure Ubuntu with Dual Monitor</a>
</li>
</ul>
View
14 sitemap.xml
@@ -23,12 +23,22 @@
<lastmod>2013-03-10T21:14:46+08:00</lastmod>
</url>
<url>
+ <loc>http://utopiazh.github.com/blog/2013/03/10/codereading-solrcloud-sharding/</loc>
+ <lastmod>2013-03-10T21:24:11+08:00</lastmod>
+ </url>
+ <url>
+ <loc>
+ http://utopiazh.github.com/blog/2013/03/17/configure-sharded-mongodb-on-single-host/
+ </loc>
+ <lastmod>2013-03-17T10:55:32+08:00</lastmod>
+ </url>
+ <url>
<loc>http://utopiazh.github.com/</loc>
- <lastmod>2013-03-10T21:14:46+08:00</lastmod>
+ <lastmod>2013-03-17T10:55:32+08:00</lastmod>
</url>
<url>
<loc>http://utopiazh.github.com/blog/archives/</loc>
- <lastmod>2013-03-10T21:14:46+08:00</lastmod>
+ <lastmod>2013-03-17T10:55:32+08:00</lastmod>
</url>
<url>
<loc>http://utopiazh.github.com/robots.txt</loc>

0 comments on commit a75d39f

Please sign in to comment.