<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>wolfg&#039;s Weblog &#187; Linux</title>
	<atom:link href="http://guoyong.org/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://guoyong.org</link>
	<description>wolfg&#039;s journey with open source, linux, programming, sysadm ...</description>
	<lastBuildDate>Thu, 04 Aug 2011 15:02:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/cn/</creativeCommons:license>		<item>
		<title>RHEL5下编译MongoDB</title>
		<link>http://guoyong.org/2011/06/01/630</link>
		<comments>http://guoyong.org/2011/06/01/630#comments</comments>
		<pubDate>Wed, 01 Jun 2011 06:21:29 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=630</guid>
		<description><![CDATA[很多人都说自己编译的稳定好用，我也来试试： 1. 参考官方文档，手工编译Spider Monkey # curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz# tar zxvf js-1.7.0.tar.gz# cd js/src# export CFLAGS=&#34;-DJS_C_STRINGS_ARE_UTF8&#34;# make -f Makefile.ref# JS_DIST=/usr make -f Makefile.ref export 2. 安装scons，用官网的rpm包就行。 3. 重新编译pcre。自带的编译时没带&#8211;enable-unicode-properties参数，mongdb启动时会提示：warning: some regex utf8 things will not work. pcre build doesn&#8217;t have &#8211;enable-unicode-properties. RPMS包是在这里找到的。 # rpm -ivh pcre-6.6-2.el5_1.7.src.rpm# vi /usr/src/redhat/SPECS/pcre.spec%configure --enable-utf8修改成%configure --enable-utf8 --enable-unicode-properties# rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec# rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre*.rpm [...]]]></description>
			<content:encoded><![CDATA[<p>很多人都说自己编译的稳定好用，我也来试试：</p>
<p>1. 参考官方文档，手工编译Spider Monkey</p>
<div class="hl-surround"><div class="hl-main"># curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz<br /># tar zxvf js-1.7.0.tar.gz<br /># cd js/src<br /># export CFLAGS=&quot;-DJS_C_STRINGS_ARE_UTF8&quot;<br /># make -f Makefile.ref<br /># JS_DIST=/usr make -f Makefile.ref export</div></div>
<p>2. 安装scons，用<a href="http://www.scons.org/download.php">官网</a>的rpm包就行。</p>
<p>3. 重新编译pcre。自带的编译时没带&#8211;enable-unicode-properties参数，mongdb启动时会提示：warning: some regex utf8 things will not work.  pcre build doesn&#8217;t have &#8211;enable-unicode-properties. RPMS包是在<a href="http://rpm.pbone.net/">这里</a>找到的。</p>
<div class="hl-surround"><div class="hl-main"># rpm -ivh pcre-6.6-2.el5_1.7.src.rpm<br /># vi /usr/src/redhat/SPECS/pcre.spec<br />%configure --enable-utf8<br />修改成<br />%configure --enable-utf8 --enable-unicode-properties<br /># rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec<br /># rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre*.rpm</div></div>
<p>4. 安装1.41版本的boost库。<a href="http://pkgs.org/centos-5-rhel-5/epel-x86_64/boost141-1.41.0-2.el5.x86_64.rpm.html">这里</a>可以找到编译好的boost库的RPM包。因为后面要编译成静态库，还需要安装boost141-static-1.41.0-2.el5.i386.rpm</p>
<p>5. 开始编译MongoDB</p>
<div class="hl-surround"><div class="hl-main"># cd mongodb-src-r1.8.1<br /># scons --libpath=/usr/lib64/boost141/ \<br />&nbsp;&nbsp; --cpppath=/usr/include/boost141/ \<br />&nbsp;&nbsp; --release --64 --static all</div></div>
<p>如果你没有&#8211;release和&#8211;static选项，可能会看见下面这样的消息<br />
 *** notice: no readline library, mongo shell will not have nice interactive line editing ***<br />
解决方法是加上&#8211;extralib=ncurses。</p>
<p>6. 安装</p>
<div class="hl-surround"><div class="hl-main"># cd mongodb-src-r1.8.1<br /># scons --libpath=/usr/lib64/boost141/ \<br />&nbsp;&nbsp; --cpppath=/usr/include/boost141/ \<br />&nbsp;&nbsp; --release --64 --static --prefix=/opt/mongo-1.8.1 install</div></div>
<p>参考：<br />
1. <a href="http://www.mongodb.org/display/DOCS/Building+for+Linux">http://www.mongodb.org/display/DOCS/Building+for+Linux</a><br />
2. <a href="http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html">http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.org/2011/06/01/630/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>再次遭遇大量CLOSE_WAIT</title>
		<link>http://guoyong.org/2010/01/22/543</link>
		<comments>http://guoyong.org/2010/01/22/543#comments</comments>
		<pubDate>Fri, 22 Jan 2010 12:51:05 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[CLOSE_WAIT]]></category>
		<category><![CDATA[HttpClient]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=543</guid>
		<description><![CDATA[今天下午线上的Jetty服务又停止响应了。不过与上次不同的是，日志里没有Too many open files的问题（看来ulimit设置管用了），看不出任何问题。于是用netstat检查网络连接，发现了大量CLOSE_WAIT状态的连接，而且都是连接到同一个IP地址。联想到程序里有调用外部网站服务的部分，检查这个IP，正是其中的一个服务。检查代码，发现开发人员使用Commons HttpClient时出了问题，居然忘记关闭连接了(method.releaseConnection();)！！后果就是对方关闭了连接，连接不断地变成CLOSE_WAIT状态，直到耗尽所有的网络资源，没法再建立连接了。 从这个教训看出，项目的研发管理真是没有到位啊！快速反复的需求、几乎可以忽略的设计、缺少代码走查、没有单元测试，怎能保证上线前发现这样的问题！]]></description>
			<content:encoded><![CDATA[<p>今天下午线上的Jetty服务又停止响应了。不过与上次不同的是，日志里没有Too many open files的问题（看来ulimit设置管用了），看不出任何问题。于是用netstat检查网络连接，发现了大量CLOSE_WAIT状态的连接，而且都是连接到同一个IP地址。联想到程序里有调用外部网站服务的部分，检查这个IP，正是其中的一个服务。检查代码，发现开发人员使用Commons HttpClient时出了问题，居然忘记关闭连接了(method.releaseConnection();)！！后果就是对方关闭了连接，连接不断地变成CLOSE_WAIT状态，直到耗尽所有的网络资源，没法再建立连接了。</p>
<p>从这个教训看出，项目的研发管理真是没有到位啊！快速反复的需求、几乎可以忽略的设计、缺少代码走查、没有单元测试，怎能保证上线前发现这样的问题！</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.org/2010/01/22/543/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>遭遇&#8221;java.io.IOException: Too many open files&#8221;</title>
		<link>http://guoyong.org/2010/01/20/520</link>
		<comments>http://guoyong.org/2010/01/20/520#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:47:21 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=520</guid>
		<description><![CDATA[今天下午，线上的Jetty服务宕机了，日志里大量的&#8221;java.io.IOException: Too many open files&#8221;错误。搜索到Freddy Chu的博客里正好有关于此的解决办法。 $ sysctl fs.file-max$ lsof -u jetty -nn &#124; wc -l$ ulimit -a$ sudo vi /etc/security/limits.conf* soft nofile 65535* hard nofile 65535 同时发现了系统里也有Freddy Chu提到的&#8221;Too many CLOSE_WAIT&#8221;问题，谢谢Freddy Chu。 $ sudo vi /etc/sysctl.confnet.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_intvl = 2net.ipv4.tcp_keepalive_probes = 2net.ipv4.tcp_keepalive_time = 1800$ sudo sysctl -p Update(2010-01-21): root用户要特殊设置 $ sudo vi /etc/security/limits.confroot soft nofile [...]]]></description>
			<content:encoded><![CDATA[<p>今天下午，线上的Jetty服务宕机了，日志里大量的&#8221;java.io.IOException: Too many open files&#8221;错误。搜索到<a href="http://tux.hk/">Freddy Chu</a>的博客里正好有关于此的解决办法。</p>
<div class="hl-surround"><div class="hl-main">$ sysctl fs.file-max<br />$ lsof -u jetty -nn | wc -l<br />$ ulimit -a<br />$ sudo vi /etc/security/limits.conf<br />* soft nofile 65535<br />* hard nofile 65535</div></div>
<p>同时发现了系统里也有Freddy Chu提到的&#8221;Too many CLOSE_WAIT&#8221;问题，谢谢Freddy Chu。</p>
<div class="hl-surround"><div class="hl-main">$ sudo vi /etc/sysctl.conf<br />net.ipv4.tcp_fin_timeout = 30<br />net.ipv4.tcp_keepalive_intvl = 2<br />net.ipv4.tcp_keepalive_probes = 2<br />net.ipv4.tcp_keepalive_time = 1800<br /><br />$ sudo sysctl -p</div></div>
<blockquote><p>Update(2010-01-21): root用户要特殊设置</p>
<div class="hl-surround"><div class="hl-main">$ sudo vi /etc/security/limits.conf<br />root soft nofile 65535<br />root hard nofile 65535</div></div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.org/2010/01/20/520/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

