<?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>Everybody loves Rui</title>
	<atom:link href="http://www.rui-yang.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rui-yang.com</link>
	<description>Stay hungry, stay foolish - 求知若饥，虚心若愚</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:00:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>亲爱的老板：程序员的10分钟就是3个小时</title>
		<link>http://www.rui-yang.com/life/%e4%ba%b2%e7%88%b1%e7%9a%84%e8%80%81%e6%9d%bf%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%91%98%e7%9a%8410%e5%88%86%e9%92%9f%e5%b0%b1%e6%98%af3%e4%b8%aa%e5%b0%8f%e6%97%b6/</link>
		<comments>http://www.rui-yang.com/life/%e4%ba%b2%e7%88%b1%e7%9a%84%e8%80%81%e6%9d%bf%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%91%98%e7%9a%8410%e5%88%86%e9%92%9f%e5%b0%b1%e6%98%af3%e4%b8%aa%e5%b0%8f%e6%97%b6/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 05:00:42 +0000</pubDate>
		<dc:creator>Rui</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[mood]]></category>

		<guid isPermaLink="false">http://www.rui-yang.com/?p=488</guid>
		<description><![CDATA[导读：国外程序员艾德·韦斯曼（Ed Weissman ）从业32年。某天老板告诉他产品有个问题，10分钟可以修复问题，谁知结果一干就是3个小时。本文就是艾德记录下的过程。 10:48 老板：嗨，艾德，苏在底特律说，“产品历史屏幕”上经常出现错误的发票号码（Invoice Part Number）。你能帮我们搞定这个问题么？ 艾德： 我现在在忙其他事。你到我的任务队列中提交一个ticket吧。 老板： 这事10分钟就够了。 艾德： 你确信么？ 老板： 嗯，确定。我一会开个网络会议。苏会演示给你看，然后你有空的时候再仔细看看。 艾德： 好的。 老板： 嗯。去你的 Outlook 中查收（会议）邀请吧。 11:05 收到 11:30 的网络会议的 Outlook 邀请，接受。 11:25 从我的IP电话呼叫了网络会议的800号码。拨了两次，都占线。从IP电话打我手机，同样是忙。哎，IP电话系统再次坏了。从我手机呼叫了网络会议的号码。我是第一个上线了，然后又挂掉了。在浏览器中点击链接进入了网络会议，还是第一个。 （艾德开始在浏览器的另一个选项卡中看 Hacker News。） 11:38 老板进入会议，问：苏在哪里？ 艾德： 我不知道。 老板： 你能看到我的屏幕么？ 艾德： 不能。 &#8230;<p class="read-more"><a href="http://www.rui-yang.com/life/%e4%ba%b2%e7%88%b1%e7%9a%84%e8%80%81%e6%9d%bf%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%91%98%e7%9a%8410%e5%88%86%e9%92%9f%e5%b0%b1%e6%98%af3%e4%b8%aa%e5%b0%8f%e6%97%b6/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>导读：国外<a title="程序员的本质" href="http://blog.jobbole.com/821/">程序员</a>艾德·韦斯曼（Ed Weissman ）从业32年。某天老板告诉他产品有个问题，10分钟可以修复问题，谁知结果一干就是3个小时。本文就是艾德记录下的过程。</p>
<p>10:48</p>
<p>老板：嗨，艾德，苏在底特律说，“产品历史屏幕”上经常出现错误的发票号码（Invoice Part Number）。你能帮我们搞定这个问题么？</p>
<p>艾德： 我现在在忙其他事。你到我的任务队列中提交一个ticket吧。</p>
<p>老板： 这事10分钟就够了。</p>
<p>艾德： 你确信么？</p>
<p>老板： 嗯，确定。我一会开个网络会议。苏会演示给你看，然后你有空的时候再仔细看看。</p>
<p>艾德： 好的。</p>
<p>老板： 嗯。去你的 Outlook 中查收（会议）邀请吧。</p>
<p>11:05</p>
<p>收到 11:30 的网络会议的 Outlook 邀请，接受。</p>
<p>11:25</p>
<p>从我的IP电话呼叫了网络会议的800号码。拨了两次，都占线。从IP电话打我手机，同样是忙。哎，IP电话系统再次坏了。从我手机呼叫了网络会议的号码。我是第一个上线了，然后又挂掉了。在浏览器中点击链接进入了网络会议，还是第一个。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>11:38</p>
<p>老板进入会议，问：苏在哪里？</p>
<p>艾德： 我不知道。</p>
<p>老板： 你能看到我的屏幕么？</p>
<p>艾德： 不能。</p>
<p>老板： 哦，等一下。我来做主（Let me be the host）。现在能看到了么？</p>
<p>艾德： ?嗯，可以了。但我想苏是不是去展示问题了。</p>
<p>老板： 对。我一会让她做主。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）<span id="more-488"></span></p>
<p><a href="http://www.linuxeden.com/upimg/allimg/120206/102052D17-0.jpg"><img title="time-management-clock" src="http://www.linuxeden.com/upimg/allimg/120206/102052D17-0.jpg" alt="time-management-clock" /></a></p>
<p>&nbsp;</p>
<p>11:47</p>
<p>苏进入会议：我们怎么在这里呢？</p>
<p>老板： 来这儿的目的就是让你给艾德展示“产品历史屏幕”出什么问题了。</p>
<p>苏： 展示“产品历史屏幕”的问题？</p>
<p>老板： 你知道的，你不说发票部分号码有时候会出错么？</p>
<p>苏：你指 mil-spec 订单？</p>
<p>老板： 我真的不知道。你不发送了ticket么？</p>
<p>苏： ticket 号码是多少呢？</p>
<p>老板：稍等，我查一下。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>11:53</p>
<p>老板： ticket 号码是 13827。记住了吧？</p>
<p>苏： 我怎么在我电脑上查看 ticket。</p>
<p>老板： 点击内网中的 IT 控制板。</p>
<p>苏： 我点不了啊。网络会议软件全屏了。</p>
<p>老板： ?那你在键盘敲击Alt+F4，然后去内网。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>11:57</p>
<p>苏： 搞定，ticket 号码是多少呢？</p>
<p>老板： 我应该写下来了。我再找找……</p>
<p>老板： 13827.</p>
<p>苏： 嗯，我看到了。 这个问题出现过几次。没人知道为什么。通常在 R27-83 这个号码时出问题了。</p>
<p>老板： 好，给艾德看吧。</p>
<p>苏： 我怎么回到网络会议界面呢？</p>
<p>老板： 你得重启了。刚才Alt+F4给关闭退出了。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>12:04</p>
<p>苏： 好了，网络会议软件打开了。你能看到我么？</p>
<p>老板：不能，你得点击“Host”按钮。</p>
<p>苏：在哪里？</p>
<p>老板： 在右上角的小方框中。</p>
<p>苏：是“History”框么？</p>
<p>老板： 不是，是“Attendees”框。</p>
<p>苏： 好的。现在你能看到我了么？</p>
<p>老板：不能。再试。</p>
<p>苏： 我试了。好像你得退出主模式吧。</p>
<p>老板： 哦，我忘了。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>12:14</p>
<p>老板： 我退出主模式了。你再试试。</p>
<p>苏： ?好的。现在你能看到我的屏幕了吧？</p>
<p>老板： 可以看到。</p>
<p>艾德： 我也可以。</p>
<p>苏： 好的，如果我进入主菜单，点击“Operations”，然后点击“Sales”，再点击“History”，我到了“Sales History”菜单。看到了吧？</p>
<p>老板：嗯。</p>
<p>艾德： 看到了。</p>
<p>苏： ?然后我按“Part”点击“Sales History Display”。输入”R27-93″，主屏幕弹出来了。然后我点击“Invoices”，我摁 F5，再 F3，再 F7，发票号码（Invoice Part Number）就变成了”GT548″。不应该这样的。</p>
<p>艾德：好，让我查看一下，再答复你。</p>
<p>老板： OK，再见。</p>
<p>苏： OK，拜拜。</p>
<p>艾德现在陷入了主模式，因为其他两位退出了。他不能退出。窗口锁定了。他重启电脑了。</p>
<p>12:38</p>
<p>艾德登录，进入开发系统。进入主屏幕，点击“Operations”，然后点击“Sales”，再点击“History”，到了“Sales History”菜单。然后按“Part”点击“Sales History Display”。他输入”R27-93″，主屏幕弹出。他然后点击“Invoices”，摁 F5，再 F3，再 F7，发票号码（Invoice Part Number）还是”R27-93″，本该就如此。在开发系统中工作正常。</p>
<p>12:46</p>
<p>艾德通过他的秘密后门登录产品。进入主屏幕，点击“Operations”，然后点击“Sales”，再点击“History”，到了“Sales History”菜单。然后按“Part”点击“Sales History Display”。他输入”R27-93″，主屏幕弹出。他然后点击“Invoices”，摁 F5，再 F3，再 F7，发票号码（Invoice Part Number）变成了”GT548″。苏没说错。</p>
<p>12:57</p>
<p>艾德查看了版本控制系统。这个问题弗瑞德（Fred）在11月11日已经 check out。艾德运行了一个 diff，看到弗瑞德已经发现他更改后的第425行的代码有问题，并修正了。</p>
<p>1:03</p>
<p>艾德呼叫弗瑞德，看他在忙啥。Voice mail。</p>
<p>1:07</p>
<p>艾德给弗瑞德发电子邮件，解释问题。</p>
<p>艾德继续看 Hacker News。</p>
<p>1:17</p>
<p>弗瑞德回拨艾德。艾德告诉他去看邮件。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>1:28</p>
<p>弗瑞德回拨：OK，我想起来了。程序出错，是因为一个离岸外包的程序员改变了“Operations”目录下所有程序的header。他在重新编译前不小心删了一行代码。不知怎么地，还通过了QA，现在苏发现了这个Bug。</p>
<p>艾德： 那么你现在能修复么？</p>
<p>艾德：不行吧。这个模块中还有12个其他的改动。我先看看，再打给你。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>1:36</p>
<p>弗瑞德回拨：在 XL500 模块通过之前，我是改不了这些变动。模块被冻结（on hol），必须得让QA先批准。所以我们只能等了。</p>
<p>艾德：好的，谢谢弗瑞德。我一会就给老板发邮件告诉他。</p>
<p>艾德给老板发了解释邮件。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>1:48</p>
<p>老板： 好，这个看起来是个问题。貌似我不得不升级指导委员会了（Steering Committee）。艾德，很高兴你能分出10分钟来。谢谢。</p>
<p>（艾德开始在浏览器的另一个选项卡中看 Hacker News。）</p>
<p>英文原文：<a href="http://edweissman.com/dear-boss-for-a-programmer-10-minutes-3-hours" rel="nofollow" target="_blank">Ed Weissman</a>      编译：<a title="伯乐" href="http://www.jobbole.com/">伯乐</a>在线 – <a href="http://blog.jobbole.com/12790/" target="_blank">黄利民</a></p>
<div class="none"><div class="g-plusone" data-href="http://www.rui-yang.com/life/%e4%ba%b2%e7%88%b1%e7%9a%84%e8%80%81%e6%9d%bf%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%91%98%e7%9a%8410%e5%88%86%e9%92%9f%e5%b0%b1%e6%98%af3%e4%b8%aa%e5%b0%8f%e6%97%b6/" size="medium" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.rui-yang.com/life/%e4%ba%b2%e7%88%b1%e7%9a%84%e8%80%81%e6%9d%bf%ef%bc%9a%e7%a8%8b%e5%ba%8f%e5%91%98%e7%9a%8410%e5%88%86%e9%92%9f%e5%b0%b1%e6%98%af3%e4%b8%aa%e5%b0%8f%e6%97%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>langdetect, a simple java language identifier library</title>
		<link>http://www.rui-yang.com/develop/langdetect-a-simple-java-language-identifier-library/</link>
		<comments>http://www.rui-yang.com/develop/langdetect-a-simple-java-language-identifier-library/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 06:30:45 +0000</pubDate>
		<dc:creator>Rui</dc:creator>
				<category><![CDATA[Develop]]></category>

		<guid isPermaLink="false">http://www.rui-yang.com/?p=485</guid>
		<description><![CDATA[When I use Apache Nutch to crawl the Chinese website, there&#8217;s a problem make me unhappy, the language-identifier plugin which nutch provide can&#8217;t detect Chinese characters, I have to find a new method to identify the language that the website &#8230;<p class="read-more"><a href="http://www.rui-yang.com/develop/langdetect-a-simple-java-language-identifier-library/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>When I use Apache Nutch to crawl the Chinese website, there&#8217;s a problem make me unhappy, the language-identifier plugin which nutch provide can&#8217;t detect Chinese characters, I have to find a new method to identify the language that the website uses. Finally I went about solving this problem with &#8216;langdetect&#8217;, an open source java language detection library. The project is deployed on <a href="http://code.google.com/p/language-detection/">http://code.google.com/p/language-detection/</a>.</p>
<p>LangDetect support 53 languages, awesome! We can check the support language list from here: <a href="http://code.google.com/p/language-detection/wiki/LanguageList">http://code.google.com/p/language-detection/wiki/LanguageList</a>.</p>
<p>And we can use it as simple as the sample show in it&#8217;s project homepage.</p>
<pre>import java.util.ArrayList;
import com.cybozu.labs.langdetect.Detector;
import com.cybozu.labs.langdetect.DetectorFactory;
import com.cybozu.labs.langdetect.Language;

class LangDetectSample {
    public void init(String profileDirectory) throws LangDetectException {
        DetectorFactory.loadProfile(profileDirectory);
    }
    public String detect(String text) throws LangDetectException {
        Detector detector = DetectorFactory.create();
        detector.append(text);
        return detector.detect();
    }
    public ArrayList&lt;Language&gt; detectLangs(String text) throws LangDetectException {
        Detector detector = DetectorFactory.create();
        detector.append(text);
        return detector.getProbabilities();
    }
}</pre>
<p>When I test it, I found I need to add jsonic-1.2.x.jar into the project&#8217;s build path. Which is not contain in the package when I downloaded langdetect. So I have to download jsonic by myself and add it to build path of the project. After all, everything goes on the track now. Enjoy it!</p>
<p>By the way, langdetect provide a build of nutch&#8217;s plugin, we can integerate it with our cluster conviniently.</p>
<div class="none"><div class="g-plusone" data-href="http://www.rui-yang.com/develop/langdetect-a-simple-java-language-identifier-library/" size="medium" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.rui-yang.com/develop/langdetect-a-simple-java-language-identifier-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UBUNTU使用Ganglia监控Hadoop集群</title>
		<link>http://www.rui-yang.com/develop/ubuntu%e4%bd%bf%e7%94%a8ganglia%e7%9b%91%e6%8e%a7hadoop%e9%9b%86%e7%be%a4/</link>
		<comments>http://www.rui-yang.com/develop/ubuntu%e4%bd%bf%e7%94%a8ganglia%e7%9b%91%e6%8e%a7hadoop%e9%9b%86%e7%be%a4/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 16:00:21 +0000</pubDate>
		<dc:creator>Rui</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Hadoop]]></category>

		<guid isPermaLink="false">http://www.rui-yang.com/?p=481</guid>
		<description><![CDATA[Ganglia是一个监控服务器，集群的开源软件，能够用曲线图表现最近一个小时，最近一天，最近一周，最近一月，最近一年的服务器或者集群的cpu负载,内存,网络,硬盘等指标。 Ganglia的强大在于：ganglia服务端能够通过一台客户端收集到同一个网段的所有客户端的数据，ganglia集群服务端能够通过一台服务端收集到它下属的所有客户端数据。这个体系设计表示一台服务器能够通过不同的分层能够管理上万台机器。 操作系统环境：Ubuntu 11.10 Server x64 集群环境: namenode 192.168.1.1 datanode1 192.168.1.2 datanode2 192.168.1.3 ganglia的服务端安装在namenode上 $ sudo apt-get install  ganglia-monitor ganglia-webfront gmetad 安装脚本可能会出错，解决方法是执行以下语句在ganglia用户组下添加用户ganglia: $ sudo useradd ganglia -g ganglia 在/etc/ganglia/下会产生一个gmond.conf的配置文件。 在这个配置文件中先找到setuid = yes,改成setuid =no;然后找到在cluster块中的name，改成name =&#8221;hadoop-test&#8221;; 其他都不用改了，保存以后重启gmond服务； 二、安装服务器端 1.首先安装rrdtool $ sudo apt-get &#8230;<p class="read-more"><a href="http://www.rui-yang.com/develop/ubuntu%e4%bd%bf%e7%94%a8ganglia%e7%9b%91%e6%8e%a7hadoop%e9%9b%86%e7%be%a4/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Ganglia是一个监控服务器，集群的开源软件，能够用曲线图表现最近一个小时，最近一天，最近一周，最近一月，最近一年的服务器或者集群的cpu负载,内存,网络,硬盘等指标。</p>
<p>Ganglia的强大在于：ganglia服务端能够通过一台客户端收集到同一个网段的所有客户端的数据，ganglia集群服务端能够通过一台服务端收集到它下属的所有客户端数据。这个体系设计表示一台服务器能够通过不同的分层能够管理上万台机器。</p>
<p>操作系统环境：Ubuntu 11.10 Server x64</p>
<p>集群环境:</p>
<p>namenode 192.168.1.1</p>
<p>datanode1 192.168.1.2</p>
<p>datanode2 192.168.1.3</p>
<p>ganglia的服务端安装在namenode上</p>
<blockquote><p>$ sudo apt-get install  ganglia-monitor ganglia-webfront gmetad</p></blockquote>
<p>安装脚本可能会出错，解决方法是执行以下语句在ganglia用户组下添加用户ganglia:</p>
<blockquote><p>$ sudo useradd ganglia -g ganglia</p></blockquote>
<p>在/etc/ganglia/下会产生一个gmond.conf的配置文件。<span id="more-481"></span></p>
<p>在这个配置文件中先找到setuid = yes,改成setuid =no;然后找到在cluster块中的name，改成name =&#8221;hadoop-test&#8221;;</p>
<p>其他都不用改了，保存以后重启gmond服务；</p>
<p>二、安装服务器端</p>
<p>1.首先安装rrdtool</p>
<blockquote><p>$ sudo apt-get install rrdtool</p></blockquote>
<p>修改/etc/ganglia/gmetad.conf配置文件。</p>
<p>在这个配置文件中主要是增加一些datasource，即被监控的机器的列表。在文件末行加入</p>
<blockquote><p>data_source &#8220;hadoop-test&#8221; namenode:8649 datanode1:8649 datanode2:8649</p></blockquote>
<p>其中&#8221;hadoop-test&#8221;是集群名称，呆会要和客户端的gmond中配置的name要一致，后面多个机器名的话用空格隔开就可以了</p>
<p>配置过配置文件以后，需要重启gmetad来应用配置。</p>
<blockquote><p>$ sudo /etc/init.d/gmetad restart</p>
<p>$ sudo /etc/init.d/ganglia-monitor restart</p></blockquote>
<p>3.配置web</p>
<p>将ganglia的文件链接到apache的默认目录下</p>
<blockquote><p>$ sudo ln -s /usr/share/ganglia-webfront /var/www/ganglia</p></blockquote>
<p>现在重启动apache</p>
<blockquote><p>$ sudo /etc/init.d/apache2 restart</p></blockquote>
<p>启动成功后，通过访问http://namenode/ganglia就可以看到ganglia的首页了。</p>
<p>三、配置hadoop文件</p>
<p>找到hadoop根目录下的conf文件夹下的hadoop-metrics.properties文件</p>
<p>改成如下内容</p>
<blockquote><p># Configuration of the &#8220;dfs&#8221; context for ganglia</p>
<p>dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext</p>
<p>dfs.period=10</p>
<p>dfs.servers=239.2.11.71:8649</p>
<p># Configuration of the &#8220;mapred&#8221; context for ganglia</p>
<p>mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext</p>
<p>mapred.period=10</p>
<p>mapred.servers=239.2.11.71:8649</p>
<p># Configuration of the &#8220;jvm&#8221; context for ganglia</p>
<p>jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext</p>
<p>jvm.period=10</p>
<p>jvm.servers=239.2.11.71:8649</p></blockquote>
<p>注：239.2.11.71这个是ganglia用的多播的地址，不需要改成gmetad的服务器地址</p>
<p>如果需要监控hbase的话，也一样找到hbase目录下的这个文件，改法一样就不重复了。 改完以后将配置文件分发到各个datanode节点的${HADOOP_HOME}/conf目录下，重启Hadoop集群即可。</p>
<p>本文参考了<a href="http://www.cnblogs.com/lijun4017/archive/2011/08/11/2135031.html">http://www.cnblogs.com/lijun4017/archive/2011/08/11/2135031.html</a>，将服务器环境改为在Ubuntu Server上进行配置。</p>
<p>&nbsp;</p>
<div class="none"><div class="g-plusone" data-href="http://www.rui-yang.com/develop/ubuntu%e4%bd%bf%e7%94%a8ganglia%e7%9b%91%e6%8e%a7hadoop%e9%9b%86%e7%be%a4/" size="medium" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.rui-yang.com/develop/ubuntu%e4%bd%bf%e7%94%a8ganglia%e7%9b%91%e6%8e%a7hadoop%e9%9b%86%e7%be%a4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build Nutch 1.4 cluster with Hadoop</title>
		<link>http://www.rui-yang.com/develop/build-nutch-1-4-cluster-with-hadoop/</link>
		<comments>http://www.rui-yang.com/develop/build-nutch-1-4-cluster-with-hadoop/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 07:35:48 +0000</pubDate>
		<dc:creator>Rui</dc:creator>
				<category><![CDATA[Develop]]></category>
		<category><![CDATA[Hadoop]]></category>
		<category><![CDATA[Nutch]]></category>

		<guid isPermaLink="false">http://www.rui-yang.com/?p=473</guid>
		<description><![CDATA[The current released version of Apache Nutch is 1.4. Since Nutch 1.3, there was no Hadoop distribution integrated with Nutch&#8217;s release package. So I have to build a Hadoop cluster seperately first, and then configure Nutch 1.4 work with Hadoop. &#8230;<p class="read-more"><a href="http://www.rui-yang.com/develop/build-nutch-1-4-cluster-with-hadoop/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The current released version of Apache Nutch is 1.4. Since Nutch 1.3, there was no Hadoop distribution integrated with Nutch&#8217;s release package. So I have to build a Hadoop cluster seperately first, and then configure Nutch 1.4 work with Hadoop. My server OS is ubuntu 10.04 LTS, I have two server names cluster1 and cluster2. I&#8217;ll note the steps here.<span id="more-473"></span></p>
<h5><span style="color: #000000;"><strong>Preparation</strong></span></h5>
<p>First of all, download Apache Nutch 1.4 from</p>
<p><a href="http://nutch.apache.org/">http://nutch.apache.org/</a></p>
<p>and Hadoop 0.20.2 from</p>
<p><a href="http://hadoop.apache.org/common/releases.html#Download">http://hadoop.apache.org/common/releases.html#Download</a>.</p>
<p>Create user &#8220;nutch&#8221; ont both cluster1 and cluster2:</p>
<blockquote><p>$ sudo adduser nutch</p></blockquote>
<p>Input the password for user &#8220;nutch&#8221;, after that  configure the server to use ssh to access slaves from master without password. We use cluster1 as master and cluster2 as slave. I will configure the work environment on cluster1 and then copy them to cluster2. Now configure the SSH first, I assume that the OpenSSH and JDK has been installed on the servers. Login to cluster1 with user &#8220;nutch&#8221; and create a SSH key, then copy the public key to cluster2:</p>
<blockquote><p>$ ssh-keygen -t rsa -P &#8220;&#8221;</p>
<p>$ cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys</p>
<p>$ scp ~/.ssh/authorized_keys nutch@cluster2:/home/nutch/.ssh/authorized_keys</p></blockquote>
<p>Now edit /etc/hosts file on servers, add two lines like:</p>
<blockquote><p>x.x.x.x    cluster1<br />
y.y.y.y    cluster2</p></blockquote>
<h5><span style="color: #000000;">Install Hadoop 0.20.2</span></h5>
<p>I configured Hadoop following this two post:</p>
<p><a href="http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/">http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-single-node-cluster/</a></p>
<p><a href="http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/">http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/</a></p>
<p>The difference was I put hadoop in my /home/nutch/hadoop folder and my conf/master file&#8217;s content:</p>
<blockquote><p>cluster1</p></blockquote>
<p>My conf/slaves file&#8217;s content:</p>
<blockquote><p>cluster1</p>
<p>cluster2</p></blockquote>
<p>Now change the contents of conf/core-site.xml, conf/hdfs-site.xml and conf/mapred-site.xml</p>
<p>conf/core-site.xml</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;?xml-stylesheet type=&#8221;text/xsl&#8221; href=&#8221;configuration.xsl&#8221;?&gt;</p>
<p>&lt;configuration&gt;</p>
<p>&lt;property&gt;<br />
&lt;name&gt;hadoop.tmp.dir&lt;/name&gt;<br />
&lt;value&gt;/home/nutch/hadoop/tmp&lt;/value&gt;<br />
&lt;/property&gt;</p>
<p>&lt;property&gt;<br />
&lt;name&gt;fs.default.name&lt;/name&gt;<br />
&lt;value&gt;hdfs://cluster1:9000&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;/configuration&gt;</p></blockquote>
<p>conf/hdfs-site.xml</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;?xml-stylesheet type=&#8221;text/xsl&#8221; href=&#8221;configuration.xsl&#8221;?&gt;</p>
<p>&lt;configuration&gt;</p>
<p>&lt;property&gt;<br />
&lt;name&gt;dfs.name.dir&lt;/name&gt;<br />
&lt;value&gt;/home/nutch/filesystem/name&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;dfs.data.dir&lt;/name&gt;<br />
&lt;value&gt;/home/nutch/filesystem/data&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;dfs.replication&lt;/name&gt;<br />
&lt;value&gt;2&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;/configuration&gt;</p></blockquote>
<p>conf/mapred-site.xml</p>
<blockquote><p>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;?xml-stylesheet type=&#8221;text/xsl&#8221; href=&#8221;configuration.xsl&#8221;?&gt;</p>
<p>&lt;!&#8211; Put site-specific property overrides in this file. &#8211;&gt;</p>
<p>&lt;configuration&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;mapred.job.tracker&lt;/name&gt;<br />
&lt;value&gt;cluster1:9001&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;mapred.map.tasks&lt;/name&gt;<br />
&lt;value&gt;2&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;mapred.reduce.tasks&lt;/name&gt;<br />
&lt;value&gt;2&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;mapred.system.dir&lt;/name&gt;<br />
&lt;value&gt;/home/nutch/filesystem/mapreduce/system&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;property&gt;<br />
&lt;name&gt;mapred.local.dir&lt;/name&gt;<br />
&lt;value&gt;/home/nutch/filesystem/mapreduce/local&lt;/value&gt;<br />
&lt;/property&gt;<br />
&lt;/configuration&gt;</p></blockquote>
<p>After configuring hadoop on cluster1, I copied the hadoop folder to cluster2:</p>
<blockquote><p>$ scp -r ~/hadoop nutch@cluster2:/home/nutch/</p></blockquote>
<h5><span style="color: #000000;">Install Nutch 1.4</span></h5>
<p>Unpack nutch 1.4 to /home/nutch/nutch:</p>
<blockquote><p>$ tar xvf apache-nutch-1.4-bin.tar.gz -C ~/nutch</p></blockquote>
<p>Copy conf/nutch-default.xml to conf/nutch-site.xml and edit conf/nutch-site.xml:</p>
<blockquote><p>$ cd ~/nutch</p>
<p>$ cp conf/nutch-default.xml conf/nutch-site.xml &amp;&amp; vim conf/nutch-site.xml</p></blockquote>
<p>Search the http.agent.name key and set value to your crawler name.</p>
<p>Then copy the hadoop-env.sh, core-site.xml, hdfs-site.xml, mapred-site.xml, master, slaves from hadoop/conf to nutch/conf, after that, copy nutch/conf to nutch/runtime/local/conf.</p>
<blockquote><p>$ cd ~/hadoop/conf</p>
<p>$ cp hadoop-env.sh core-site.xml hdfs-site.xml mapred-site.xml master slaves ~/nutch/conf/</p>
<p>$ cd ~/nutch</p>
<p>$ cp conf/* runtime/local/conf/</p></blockquote>
<p><span style="color: #000000;"><strong>Here is the key point</strong></span></p>
<p>We have to rebuild nutch 1.4 with ant, or we&#8217;ll get an error which tell us something like the http.agent.name doesn&#8217;t work even we have edit our nutch-site.xml file. Now run ant to rebuild nutch:</p>
<blockquote><p>$ export CLASSPATH=.:/home/nutch/nutch/runtime/local/lib</p>
<p>$ ant</p></blockquote>
<p>After ant finishing, copy the nutch-1.4.job and nutch-1.4.jar to the deploy and local workspace.</p>
<blockquote><p>$ cp build/nutch-1.4.job runtime/deploy/</p>
<p>$ cp build/nutch-1.4.jar runtime/local/lib/</p></blockquote>
<p>Now the cluster has been built successfully and we can use it just as what we did in Nutch 1.2. The only different operation is that the start-all.sh of hadoop is not placed in nutch&#8217;s bin folder anymore. We could execute it from $HADOOP_HOME/bin.</p>
<div class="none"><div class="g-plusone" data-href="http://www.rui-yang.com/develop/build-nutch-1-4-cluster-with-hadoop/" size="medium" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.rui-yang.com/develop/build-nutch-1-4-cluster-with-hadoop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress with Nginx: Solve the 404 after changing permalinks structure</title>
		<link>http://www.rui-yang.com/web/wordpress-with-nginx-solve-the-404-after-changing-permalinks-structure/</link>
		<comments>http://www.rui-yang.com/web/wordpress-with-nginx-solve-the-404-after-changing-permalinks-structure/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 13:06:18 +0000</pubDate>
		<dc:creator>Rui</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.rui-yang.com/?p=465</guid>
		<description><![CDATA[Today I tried to change my site&#8217;s permalinks, but I can&#8217;t visit all old posts with a 404 error. I searched for a solution and found that I can add following section in my vhost conf file under nginx configurations. &#8230;<p class="read-more"><a href="http://www.rui-yang.com/web/wordpress-with-nginx-solve-the-404-after-changing-permalinks-structure/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Today I tried to change my site&#8217;s permalinks, but I can&#8217;t visit all old posts with a 404 error. I searched for a solution and found that I can add following section in my vhost conf file under nginx configurations.</p>
<blockquote>
<div>location / {</div>
<div>        &#8230;&#8230;<br />
if (!-e $request_filename) {</div>
<p>rewrite ^(.*)$ /index.php?q=$1 last;<br />
break;</p>
<div>        }</div>
<div>}</div>
</blockquote>
<div>Then restart nginx and change the permalinks structure in wordpress. Everything goes on track now.</div>
<div class="none"><div class="g-plusone" data-href="http://www.rui-yang.com/web/wordpress-with-nginx-solve-the-404-after-changing-permalinks-structure/" size="medium" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.rui-yang.com/web/wordpress-with-nginx-solve-the-404-after-changing-permalinks-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

