<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>WHO IS 2HEI?</title>
        <link>http://www.2hei.net/mt/</link>
        <description>on my way ... </description>
        <language>zh-cn</language>
        <copyright>Copyright 2010</copyright>
        <lastBuildDate>Wed, 03 Mar 2010 15:14:10 +0800</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>ethtool maybe caused by &quot;TCP checksum offload&quot;</title>
            <description><![CDATA[<p>使用tcpdump抓包时发现有这样的错误信息：</p>
<p>Transmission Control Protocol, Src Port: 44937 (44937), Dst Port: https (443), Seq: 111, Ack: 147, Len: 6</p>
<p>Checksum: 0x5edd [incorrect, should be 0x15db (maybe caused by "TCP checksum offload"?)]<br />&nbsp;Good Checksum: False<br />&nbsp;Bad Checksum: True</p>
<p>或许是TCP checksum offload的原因</p>
<p>查看本机的网卡信息<br /><a href="http://2hei.net">2hei</a># ethtool -k eth0<br />Offload parameters for eth0:<br />Cannot get device rx csum settings: Operation not supported<br />Cannot get device udp large send offload settings: Operation not supported<br />rx-checksumming: off<br />tx-checksumming: on<br />scatter-gather: on<br />tcp segmentation offload: off<br />udp fragmentation offload: off<br />generic segmentation offload: off</p>
<p>其他一些帮助<br />ethtool -K|--offload DEVNAME&nbsp;&nbsp;&nbsp; Set protocol offload<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ rx on|off ]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ tx on|off ]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ sg on|off ]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ tso on|off ]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ ufo on|off ]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ gso on|off ]</p>
<p>关闭rx和tx<br />#ethtool -K rx off<br />#ethtool -K tx off<br />#ethtool -K eth0 rx off tx off tso off gso off</p>
<p>也可用这个命令<br />#ethtool -K eth0 tx off tso off</p>
<p>打开<br />#ethtool -K eth0 tx on <br />#ethtool -K eth0 tso on</p>
<p>关闭tx和rx后，再次抓包，结果显示正常。</p>
<p>CheckSum Offload实际上是将传输层的一部分工作交给了硬件完成，以节约系统的CPU资源。wireshark在本地抓包时看到是系统随机填充的校验和，所以会显示Checksum Offload，实际并不影响数据包的正常传输。<br />微软的测试表明它可以最多节约30%的CPU资源。IBM里AIX的文档则指出：对于PCI接口的千兆网卡来说还不如让400Mhz以上的CPU来计算校验和，而PCI-X的千兆网卡启用此项后可以达到线路速度，从而节约CPU资源。</p>
<p>详细可见： <a href="http://www.microsoft.com/whdc/device/network/taskoffload.mspx">http://www.microsoft.com/whdc/device/network/taskoffload.mspx</a></p>]]></description>
            <link>http://www.2hei.net/mt/2010/03/ethtool-maybe-caused-by-tcp-checksum.html</link>
            <guid>http://www.2hei.net/mt/2010/03/ethtool-maybe-caused-by-tcp-checksum.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">ethtool</category>
            
            <pubDate>Wed, 03 Mar 2010 15:14:10 +0800</pubDate>
        </item>
        
        <item>
            <title>request.getScheme cann&apos;t get https in nginx proxy with apache</title>
            <description><![CDATA[程序中为了不写死url，使用了动态获得的方式：<br />basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";<br /><br />其中： request.getScheme() return http but not https.<br />之前单独使用apache（https）+resin的方式正常，现在前面增加了一层nginx，发现问题来了，协议部分（Scheme）无法传过去，后台的resin无法获取到正确的值。<br /><br />尝试了下面的配置，结果还是一无所获。<br />&nbsp;&nbsp;&nbsp; proxy_redirect off;<br />&nbsp;&nbsp;&nbsp; proxy_set_header HTTPS&nbsp; on;<br />&nbsp;&nbsp;&nbsp; proxy_set_header Host $host;<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Url-Scheme $scheme;<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Scheme $scheme;<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Nginx-Scheme $scheme;<br />&nbsp;&nbsp;&nbsp; proxy_set_header Scheme $scheme;<br />&nbsp;&nbsp;&nbsp; proxy_set_header&nbsp; X-FORWARDED_PROTO $scheme;<br />&nbsp;&nbsp;&nbsp; proxy_set_header&nbsp; X-FORWARDED_PROTO "https";<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-Scheme "https";<br />&nbsp;&nbsp;&nbsp; proxy_set_header X-Forwarded-Proto $scheme;<br />&nbsp;&nbsp;&nbsp; real-scheme-header&nbsp;&nbsp;&nbsp;&nbsp; X-Forwarded-Proto;<br /><br /><br />今天下午好好google了一番，所有的帖子几乎翻了个遍，终于有所收获啦，重点是nginx配置完毕后，apache也要配置环境变量哦！<br /><a href="http://www.ruby-forum.com/topic/183450">http://www.ruby-forum.com/topic/183450</a><br /><br />nginx config:<br />=============<br />proxy_set_header X-Nginx-Scheme $scheme;<br /># nginx variable $scheme will be 'http' or 'https'.<br /><br /><br />apache config:<br />==============<br />SetEnvIf X-Nginx-Scheme "^https$" HTTPS=on<br /># Apache environment variable HTTPS will be 'on' or not defined.<br /><br /><br />测试代码如下：<br />&lt;%<br />out.println("Protocol: " + request.getProtocol() + "&lt;br&gt;");<br />out.println("Scheme: " + request.getScheme() + "&lt;br&gt;");<br />out.println("Server Name: " + request.getServerName() + "&lt;br&gt;" );<br />out.println("Server Port: " + request.getServerPort() + "&lt;br&gt;");<br />%&gt;<br /><br />页面打印结果为，正常了！<br />Protocol: HTTP/1.0<br />Scheme: https<br />Server Name: <a href="http://2hei.net/">2hei.net</a><br />Server Port: 443 ]]></description>
            <link>http://www.2hei.net/mt/2010/02/request-getscheme-cannt-get-https.html</link>
            <guid>http://www.2hei.net/mt/2010/02/request-getscheme-cannt-get-https.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">nginx</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">nginx</category>
            
            <pubDate>Sun, 21 Feb 2010 15:37:43 +0800</pubDate>
        </item>
        
        <item>
            <title>resin使用了struts/spring等框架与apache整合时需要注意事项</title>
            <description><![CDATA[resin使用了struts/spring等框架与apache整合时需要注意以下：<br /><br />默认情况resin ResinConfigServer配置不支持除了jsp和servlet之外的其他不规则映射，apache对此类URL会返回404，或者无效的servlet，这就用到了resin的plugin_match配置。<br />如：<br />&lt;servlet-mapping url-pattern="*.do" servlet-name="plugin_match"/&gt;<br /><br />几种常见的resin解析方式：<br />&lt;servlet-mapping url-pattern="*.jsp" servlet-name="jsp"/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; #jsp文件<br />&lt;servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/&gt;&nbsp;&nbsp;&nbsp; #标准的servlet<br />&lt;servlet-mapping url-pattern="*.xtp" servlet-name="xtp"/&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; #resin自定义的一种格式<br />&lt;servlet-mapping url-pattern="*.do" servlet-name="plugin_match"/&gt;&nbsp;&nbsp; #扩展匹配，如struts]]></description>
            <link>http://www.2hei.net/mt/2010/02/resin-struts-spring-apache.html</link>
            <guid>http://www.2hei.net/mt/2010/02/resin-struts-spring-apache.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">resin</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">resin</category>
            
            <pubDate>Sat, 06 Feb 2010 12:09:44 +0800</pubDate>
        </item>
        
        <item>
            <title>device lo left promiscuous mode</title>
            <description><![CDATA[<br />dmesg发现有一些这样的信息：<br /><br />device lo left promiscuous mode<br />audit(1264387352.387:24): dev=lo prom=0 old_prom=256 auid=4294967295 ses=4294967295<br /><br /><br />发现是tcpdump 抓包导致,对系统并无大碍！<br /><br /> ]]></description>
            <link>http://www.2hei.net/mt/2010/01/device-lo-left-promiscuous-mod.html</link>
            <guid>http://www.2hei.net/mt/2010/01/device-lo-left-promiscuous-mod.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">tcpdump</category>
            
            <pubDate>Thu, 28 Jan 2010 14:40:32 +0800</pubDate>
        </item>
        
        <item>
            <title>《网瘾战争》--看你妹</title>
            <description><![CDATA[一口气看完了60多分钟的《网瘾战争》，真是有些感动。。。<br /><br />我和其他热爱这个游戏的人一样<br />认真地挤着公交车上班<br />认真地消费着各式各样的食品<br />不管里面有没有不认识的化学成分<br />我们没有因为工资微薄而抱怨过<br />没有因为你们拿着从我微薄工资里扣的税<br />住着联体排屋而心理失衡过<br />在这一年里，我和其他热爱这个游戏的人一样<br />为水灾，为地震而痛心哭泣<br />为载人航天，为奥运会而加油喝彩<br />我们打心眼里，就不想我们在任何一个方面<br />落后于这个世界上的任何一个民族<br />而这一年里，却因为你们这些人<br />我们迟迟不能与地球上其他国家的玩家一起，一决高下<br />为了真心喜爱的游戏<br />我们委曲求全，我们被迫离开<br />我们冒着被封号的危险去美服欧服<br />他们骂我们是金币农民<br />我们顶着上万的延时去台服<br />他们说我们是大陆蝗虫<br />这些何其贬低的称谓<br />我们都在默默地承受<br />我们凭什么不能拥有每小时4毛钱的廉价娱乐？<br />就凭我在国服？<br />凭我是国服的魔兽玩家吗？<br />你们从小就对我灌输<br />金窝、银窝不如自己的狗窝<br />那现实呢？<br />你们已经让我只能暂住在自己的国家<br />难道我们精神上的家园<br />连暂住在自己的国家，都不行吗？<br /><br />ps: youku视频已被河蟹！<br /><a href="http://www.tudou.com/programs/view/8w0z0Q_TAQI/">土豆上的视频</a>不知道还能撑多久？ <br /><br /><br />]]></description>
            <link>http://www.2hei.net/mt/2010/01/wow-wangyin-war.html</link>
            <guid>http://www.2hei.net/mt/2010/01/wow-wangyin-war.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">other</category>
            
            
            <pubDate>Sun, 24 Jan 2010 13:27:47 +0800</pubDate>
        </item>
        
        <item>
            <title>linux下支持https的压力测试工具</title>
            <description><![CDATA[测试了linux下的几种压力测试工具，发现有些不支持https，先简单总结如下：<br /><br /><b>一、apache的ab工具</b><br /><blockquote>/home/webadm/bin/ab -c 50 -n 10000 <a href="http://2hei.net/mt/index.html">https://2hei.net/mt/index.html</a><br />SSL not compiled in; no https support<br />看样子是说SSL没有编译进来，所以不支持https<br /></blockquote><br /><br /><b>二、apache的flood工具</b><br /><blockquote>http://httpd.apache.org/test/flood/<br /><br />wget http://www.apache.org/dist/httpd/flood/flood-0.4.tar.gz<br /><br />如果要支持https的话，需要添加如下的编译参数：--with-apr --with-apr-util --enable-ssl <br />具体代码也可以从svn获取。<br />不过我在编译的时候遇到一些问题，apr-util包在make的时候总是报错！<br /></blockquote><b><br /><br />三、web-bench工具</b><br /><blockquote>http://freshmeat.net/projects/web-bench/<br /><br />./webbench -c 20 -t 10 <a href="http://2hei.net/mt/index.html">https://2hei.net/mt/index.html</a><br />Webbench - Simple Web Benchmark 1.5<br />Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<br /><br />Only HTTP protocol is directly supported, set --proxy for others.<br />明确提示了提示不支持https哦！<br /></blockquote><br /><b>四、http_load工具，曾经的最爱，http测试的结果还很令人满意。</b><br /><blockquote>http://acme.com/software/http_load/<br />./http_load -rate 5 -seconds 10 urls<br />./http_load: unknown protocol - https://2hei.net/mt/index.html<br />吼吼，看来之前常用的http_load也不支持https<br /></blockquote><br /><br /><b>五、siege工具</b><br /><blockquote>http://www.joedog.org/index/siege-home<br /><br />编译使之支持https<br />./configure --prefix=/home/2hei.net/siege --with-ssl=/usr/include/openssl<br /><br />基本用法：<br />./siege<br />SIEGE 2.69<br />Usage: siege [options]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; siege [options] URL<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; siege -g URL<br />Options:<br />&nbsp; -V, --version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VERSION, prints version number to screen.<br />&nbsp; -h, --help&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HELP, prints this section.<br />&nbsp; -C, --config&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONFIGURATION, show the current configuration.<br />&nbsp; -v, --verbose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VERBOSE, prints notification to screen.<br />&nbsp; -g, --get&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GET, pull down headers from the server and display HTTP<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; transaction. Great for web application debugging.<br />&nbsp; -c, --concurrent=NUM&nbsp;&nbsp;&nbsp; CONCURRENT users, default is 10<br />&nbsp; -u, --url="URL"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Deprecated. Set URL as the last argument.<br />&nbsp; -i, --internet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTERNET user simulation, hits the URLs randomly.<br />&nbsp; -b, --benchmark&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BENCHMARK, signifies no delay for time testing.<br />&nbsp; -t, --time=NUMm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TIME based testing where "m" is the modifier S, M, or H<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no space between NUM and "m", ex: --time=1H, one hour test.<br />&nbsp; -r, --reps=NUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REPS, number of times to run the test, default is 25<br />&nbsp; -f, --file=FILE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FILE, change the configuration file to file.<br />&nbsp; -R, --rc=FILE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RC, change the siegerc file to file.&nbsp; Overrides<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the SIEGERC environmental variable.<br />&nbsp; -l, --log&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOG, logs the transaction to PREFIX/var/siege.log<br />&nbsp; -m, --mark="text"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MARK, mark the log file with a string separator.<br />&nbsp; -d, --delay=NUM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Time DELAY, random delay between 1 and num designed<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to simulate human activity. Default value is 3<br />&nbsp; -H, --header="text"&nbsp;&nbsp;&nbsp;&nbsp; Add a header to request (can be many)<br />&nbsp; -A, --user-agent="text" Sets User-Agent in request<br /><br /><br />siege -c 20 -r 2 -f url<br />-c 20 并发20个用户<br />-r 2 重复循环2次<br />-f url 任务列表：URL列表<br /><br /><b>结论相当凑合，纵欲找到可以支持https压力测试的工具了。</b><br /><br /></blockquote><br /><b>六、httperf工具，来自hp的工具，不过已经n年没有更新了。</b><br /><blockquote>wget ftp://ftp.hpl.hp.com/pub/httperf/httperf-0.9.0.tar.gz<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ mkdir build<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ cd build<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ SRCDIR/configure<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ make<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ make install<br /><br />工具使用方法：<br />/usr/local/bin/httperf --help<br />Usage: httperf [-hdvV] [--add-header S] [--burst-length N] [--client N/N]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--close-with-reset] [--debug N] [--failure-status N]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--help] [--hog] [--http-version S] [--max-connections N]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--max-piped-calls N] [--method S] [--no-host-hdr]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--num-calls N] [--num-conns N] [--period [d|u|e]T1[,T2]]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--port N] [--print-reply [header|body]] [--print-request [header|body]]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--rate X] [--recv-buffer N] [--retry-on-failure] [--send-buffer N]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--server S] [--server-name S] [--session-cookies]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--ssl] [--ssl-ciphers L] [--ssl-no-reuse]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--think-timeout X] [--timeout X] [--uri S] [--verbose] [--version]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--wlog y|n,file] [--wsess N,N,X] [--wsesslog N,X,file]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [--wset N,X]<br />如：<br />/usr/local/bin/httperf --server www.2hei.net \<br />&nbsp;&nbsp; --port 443 --uri /mt/index.html \<br />&nbsp;&nbsp; --rate 15 --num-conn 1000 \<br />&nbsp;&nbsp; --num-call 1 --timeout 5<br /><br />发现会有如下错误：<br />httperf: warning: open file limit &gt; FD_SETSIZE; limiting max. # of open files to FD_SETSIZE<br />以下是解决办法：<br /># Edit /etc/security/limits.conf and add the line * hard nofile 65535 (or instead of * you can put the username of the user for whom you want to change the limit)<br /># Edit /usr/include/bits/typesizes.h and change #define __FD_SET_SIZE 1024 to #define __FD_SET_SIZE 65535 (in /usr/include/sys/select.h FD_SETSIZE is defined as __FD_SETSIZE)<br />重新编译即可。<br /><br />实例测试如下：<br />/usr/local/bin/httperf --client=0/1 --ssl --server=<a href="http://www.2hei.net/">www.2hei.net</a> --port=443 --uri=/mt/index.html --rate=1 --num-conns=1000 --rate=50 --num-calls=1 --hog<br />httperf --hog --client=0/1 --server=www.2hei.net --port=443 --uri=/mt/index.html --rate=50 --send-buffer=4096 --recv-buffer=16384 --ssl --num-conns=1000 --num-calls=1<br />Maximum connect burst length: 1<br /><br />Total: connections 1000 requests 1000 replies 1000 test-duration 33.758 s<br /><br />Connection rate: 29.6 conn/s (33.8 ms/conn, &lt;=394 concurrent connections)<br />Connection time [ms]: min 73.1 avg 6513.5 max 22013.1 median 5371.5 stddev 4176.3<br />Connection time [ms]: connect 5670.7<br />Connection length [replies/conn]: 1.000<br /><br />Request rate: 29.6 req/s (33.8 ms/req)<br />Request size [B]: 80.0<br /><br />Reply rate [replies/s]: min 26.6 avg 31.3 max 33.6 stddev 2.4 (6 samples)<br />Reply time [ms]: response 842.7 transfer 0.0<br />Reply size [B]: header 331.0 content 163.0 footer 2.0 (total 496.0)<br />Reply status: 1xx=0 2xx=1000 3xx=0 4xx=0 5xx=0<br /><br />CPU time [s]: user 9.91 system 23.11 (user 29.4% system 68.5% total 97.8%)<br />Net I/O: 16.6 KB/s (0.1*10^6 bps)<br /><br />Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0<br />Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0<br /><br /></blockquote><br /> ]]></description>
            <link>http://www.2hei.net/mt/2010/01/linux-web-test-tools-for-https.html</link>
            <guid>http://www.2hei.net/mt/2010/01/linux-web-test-tools-for-https.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">linux</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">ab</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">httperf</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">http_load</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">siege</category>
            
            <pubDate>Sun, 24 Jan 2010 11:02:42 +0800</pubDate>
        </item>
        
        <item>
            <title>nginx authentication</title>
            <description><![CDATA[今天配置nginx的basic authentication折腾了好半天，开始error_log一直报错：<br />no user/password was provided for basic authentication<br /><br />我是按照nginx的wiki配置的：<br />location&nbsp; /&nbsp; {<br />&nbsp; auth_basic&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Restricted";<br />&nbsp; auth_basic_user_file&nbsp; htpasswd;<br />}<br /><br />cat htpasswd<br />2hei:j3M4coizxFLDM<br /><br />Since version 0.6.7 the filename path is relative to directory of nginx configuration file nginx.conf, but not to nginx prefix directory.<br /><br />google了半天，发现了nginx作者Igor的一个回复：<br /><blockquote><blockquote><b>Igor Sysoev</b><br /><b>The HTTP Basic authentication works as following:</b><br /><b>*) A browser requests a page without user/password.</b><br /><b>*) A server response with 401 page, sending realm as well.</b><br /><b>&nbsp;&nbsp; At this stage the 401 code appears in access_log and the message</b><br /><b>&nbsp;&nbsp; "no user/password ..." appears in error_log.</b><br /><b>*) The browser shows a realm/login/password prompt.</b><br /><b>*) If a user will press cancel, then the browser will show the received</b><br /><b>&nbsp;&nbsp; 401 page.</b><br /><b>*) If the user enters login/password, then the browser repeats the request</b><br /><b>&nbsp;&nbsp; with login/password.</b><br /><br /><b>Then until you will exit the browser, it will send these login/password</b><br /><b>with all requests in protected hierarchy.</b><br /></blockquote></blockquote><br />赞一个，牛人果然就是牛人！<br /><br />经过提示找到了罪魁祸首是error_page的配置 401 403 404 /40x.html;<br /><br />error_page 401 403 404 /40x.html;<br />实际上是由于40x.html文件并不存在导致的。把文件建好问题得以解决！<br /><br /><br /> ]]></description>
            <link>http://www.2hei.net/mt/2010/01/nginx-authentication.html</link>
            <guid>http://www.2hei.net/mt/2010/01/nginx-authentication.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">nginx</category>
            
            <pubDate>Wed, 20 Jan 2010 21:11:55 +0800</pubDate>
        </item>
        
        <item>
            <title>[notice] child pid 19818 exit signal Bus error (7)</title>
            <description><![CDATA[apache logs:<br />[Thu Dec 31 12:27:41 2009] [notice] child pid 19818 exit signal Bus error (7)<br /><br /><br />The first error "Bus Error" is caused by someones (possibly CGI) program crashing. A bus error happens when someone wrote a C program for Intel and re-compiled it for another processor like PPC or Mips that does not support misalligned memory access. Really all it means is someone is running buggy software on your server machine.<br />The second error could also be a CGI program that hangs longer than the server's timeout, so its killed. Probably another buggy program.<br /><br />That sounds like bad RAM or maybe a bad chassis. I would try and build something other the Apache and see if you get similar errors. If they persist then I would ask for a RAM swap to be done and check again. If that does not fix it then request a chassis swap.<br /><br />There is a small chance this could be OS related if you are running a different Kernel release compared to the OS default or have many patches installed on it but I am leaning towards a hardware issue.<br /><br />http://www.kernel.org/doc/man-pages/online/pages/man7/signal.7.html<br /><br />Standard Signals<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Linux supports the standard signals listed below.&nbsp; Several signal numbers are<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; architecture-dependent, as indicated in the "Value" column.&nbsp; (Where three<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; values are given, the first one is usually valid for alpha and sparc, the<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; middle one for ix86, ia64, ppc, s390, arm and sh, and the last one for mips.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A - denotes that a signal is absent on the corresponding architecture.)<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; First the signals described in the original POSIX.1-1990 standard.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Signal&nbsp;&nbsp;&nbsp;&nbsp; Value&nbsp;&nbsp;&nbsp;&nbsp; Action&nbsp;&nbsp; Comment<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ----------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGHUP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Hangup detected on controlling terminal<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or death of controlling process<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGINT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Interrupt from keyboard<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGQUIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Quit from keyboard<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGILL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Illegal Instruction<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGABRT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Abort signal from abort(3)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGFPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Floating point exception<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGKILL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Kill signal<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGSEGV&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Invalid memory reference<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGPIPE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 13&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Broken pipe: write to pipe with no<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; readers<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGALRM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 14&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Timer signal from alarm(2)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGTERM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Termination signal<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGUSR1&nbsp;&nbsp; 30,10,16&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; User-defined signal 1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGUSR2&nbsp;&nbsp; 31,12,17&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; User-defined signal 2<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGCHLD&nbsp;&nbsp; 20,17,18&nbsp;&nbsp;&nbsp; Ign&nbsp;&nbsp;&nbsp;&nbsp; Child stopped or terminated<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGCONT&nbsp;&nbsp; 19,18,25&nbsp;&nbsp;&nbsp; Cont&nbsp;&nbsp;&nbsp; Continue if stopped<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGSTOP&nbsp;&nbsp; 17,19,23&nbsp;&nbsp;&nbsp; Stop&nbsp;&nbsp;&nbsp; Stop process<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGTSTP&nbsp;&nbsp; 18,20,24&nbsp;&nbsp;&nbsp; Stop&nbsp;&nbsp;&nbsp; Stop typed at tty<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGTTIN&nbsp;&nbsp; 21,21,26&nbsp;&nbsp;&nbsp; Stop&nbsp;&nbsp;&nbsp; tty input for background process<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGTTOU&nbsp;&nbsp; 22,22,27&nbsp;&nbsp;&nbsp; Stop&nbsp;&nbsp;&nbsp; tty output for background process<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next the signals not in the POSIX.1-1990 standard but described in SUSv2 and<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSIX.1-2001.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Signal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value&nbsp;&nbsp;&nbsp;&nbsp; Action&nbsp;&nbsp; Comment<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGBUS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10,7,10&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Bus error (bad memory access)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGPOLL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Pollable event (Sys V).<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Synonym for SIGIO<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGPROF&nbsp;&nbsp;&nbsp;&nbsp; 27,27,29&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Profiling timer expired<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGSYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12,-,12&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Bad argument to routine (SVr4)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGTRAP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; Trace/breakpoint trap<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGURG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16,23,21&nbsp;&nbsp;&nbsp; Ign&nbsp;&nbsp;&nbsp;&nbsp; Urgent condition on socket (4.2BSD)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGVTALRM&nbsp;&nbsp; 26,26,28&nbsp;&nbsp;&nbsp; Term&nbsp;&nbsp;&nbsp; Virtual alarm clock (4.2BSD)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGXCPU&nbsp;&nbsp;&nbsp;&nbsp; 24,24,30&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; CPU time limit exceeded (4.2BSD)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIGXFSZ&nbsp;&nbsp;&nbsp;&nbsp; 25,25,31&nbsp;&nbsp;&nbsp; Core&nbsp;&nbsp;&nbsp; File size limit exceeded (4.2BSD)<br /><br /> ]]></description>
            <link>http://www.2hei.net/mt/2010/01/notice-child-pid-19818-exit-signal-bus-error-7.html</link>
            <guid>http://www.2hei.net/mt/2010/01/notice-child-pid-19818-exit-signal-bus-error-7.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
            <pubDate>Thu, 07 Jan 2010 14:47:45 +0800</pubDate>
        </item>
        
        <item>
            <title>使用apache的mod_rewrite模块进行端口重写且保留特殊接口</title>
            <description><![CDATA[需求如下：<br />网站的apache开通80和443端口，整站强制使用https，把所有80端口的访问转到443，新增需求为要针对某个接口单独开放80端口（80、443均可访问），剩下其他接口保持原有规则。<br /><br /><br />配置一、<br />RewriteRule !^/TestServlet http://%{SERVER_NAME}/$1 [L,R=301] 是有问题的，$1并没取得匹配的部分。<br /><br />根据apache文档，使用否字符以反转匹配模式时，匹配模式中不能使用分组的通配成分。由于模式不匹配而使分组的内容是空的，所以它是不可能实现的。 因此，如果使用了否定式匹配模式，那么后继的字符串中就不能使用$N。<br /><br />配置二、<br />RewriteRule !^/TestServlet - [L,R=301]&nbsp;&nbsp; 生效。<br /><br />apache文档说明：'-'是一个特殊的替换串，意思是不替换。它可以用于仅仅匹配某些URL而无须替换的情况，比如，在发生替换前，允许以C(chain)标记连接的多个匹配模式同时起作用。<br /><br /><br />配置三、<br />&nbsp;&nbsp;&nbsp; RewriteRule ^(.*)?$ https://%{SERVER_NAME}$1 [L,R=301]&nbsp;&nbsp; 原有将http重写为https的配置。<br />&nbsp;&nbsp;&nbsp; 所有访问<a href="http://2hei.net/">http://2hei.net</a>会转到<a href="https://2hei.net/">https://2hei.net</a> &nbsp;<br /><br />另外或许可行办法是配置apache的系统变量或者环境变量，凡是经过url重写的给变量一个特殊的标记，说明已经跳转，这样就不会出现循环跳转的现象了（没具体试过！）<br /><br /><br />实际中遇到的一个问题是apache进行url重写时，post方式提交的数据经过重写后数据会丢失，跳转后的url并没有收到post的数据，而访问跳转后的页面成了get方式。暴汗！<br /><br />网上有人说使用 P参数，<br />RewriteRule ^(.*)?$ https://%{SERVER_NAME}$1 [L,R=301,P] ，实际试用了一下，纯属扯淡！<br /><br />'proxy|P'(强制为代理)<br />此标记使替换成分被内部地强制作为代理请求发送，并立即中断重写处理，然后把处理移交给mod_proxy模块。你必须确保此替换串是一个能够被mod_proxy处理的有效URI(比如以http://hostname开头)，否则将得到一个代理模块返回的错误。使用这个标记，可以把某些远程成分映射到本地服务器域名空间，从而增强了ProxyPass指令的功能。<br />注意：要使用这个功能，必须已经启用了mod_proxy模块。<br /><br /> ]]></description>
            <link>http://www.2hei.net/mt/2010/01/apache-mod-rewrite-http-to-https.html</link>
            <guid>http://www.2hei.net/mt/2010/01/apache-mod-rewrite-http-to-https.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">apache</category>
            
            <pubDate>Thu, 07 Jan 2010 14:35:11 +0800</pubDate>
        </item>
        
        <item>
            <title>8.8.8.8-google-public-dns-for-free</title>
            <description><![CDATA[<a href="http://code.google.com/speed/public-dns/index.html">http://code.google.com/speed/public-dns/index.html</a><br /><br />What is Google Public DNS?<br /><br />Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider.<br /><br />To try it out:<br /><br />&nbsp;&nbsp;&nbsp; * Configure your network settings to use the IP addresses 8.8.8.8 and 8.8.4.4 as your DNS servers or<br />&nbsp;&nbsp;&nbsp; * Read our configuration instructions.<br /><br />If you decide to try Google Public DNS, your client programs will perform all DNS lookups using Google Public DNS. <br /><span class="mt-enclosure mt-enclosure-image"><a href="http://www.2hei.net/mt/2009/12/30/2009-12-30_094745.png"><img alt="2009-12-30_094745.png" src="http://www.2hei.net/mt/2009/12/30/2009-12-30_094745-thumb-440x198.png" class="mt-image-left" style="margin: 0pt 20px 20px 0pt; float: left;" height="198" width="440" /></a></span><br /> <div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />实际测试8.8.8.8 解析出来的貌似网通的IP，不过I like it，好记又方便，而且无dns劫持的弊端，不错！唯一担心的是有可能被墙哦！<br /></div>]]></description>
            <link>http://www.2hei.net/mt/2009/12/8888googlepublicdnsforfree.html</link>
            <guid>http://www.2hei.net/mt/2009/12/8888googlepublicdnsforfree.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">dns</category>
            
            <pubDate>Wed, 30 Dec 2009 09:44:41 +0800</pubDate>
        </item>
        
        <item>
            <title>nagios check_http 处理返回码302的情况</title>
            <description><![CDATA[nagios check_http 处理返回码302的情况<br /><br />使用nagios监控中发现这样一个问题，nagios的check_http对http返回码302的处理比较特殊，如果参数不当的话会影响监控的效果哦！<br /><br />实际情况如下：<br />在web服务器配置的errpage页面指定了503跳转，如apache+resin的组合，如果apache找不到resin会返回503，捕获的页面会跳转到指定的页面上<br /><br />1、正常情况：<br />/home/nagios/libexec/check_http -S -H <a href="http://2hei.net/">2hei.net</a> -I 10.10.10.10 -u "/monitor.jsp" -P "" -s "OK"&nbsp; -t 10<br />返回<br />HTTP OK HTTP/1.1 200 OK - 617 bytes in 0.345 seconds |time=0.345145s;;;0.000000 size=617B;;;0<br /><br />如果页面返回值不包含“OK”，则<br />HTTP CRITICAL - string not found|time=0.034220s;;;0.000000 size=617B;;;0<br /><br />如果停掉保留apache不动，停掉resin，则以外发生了，302跳转后状态仍然是OK，I服了U ！！！<br />HTTP OK - HTTP/1.1 302 Found - 0.030 second response time |time=0.029908s;;;0.000000 size=517B;;;0<br /><br />加入-v 参数后 看看详细结果：<br />https://2hei.net:443/monitor.jsp is 517 characters<br />STATUS: HTTP/1.1 302 Found<br />**** HEADER ****<br />Date: Wed, 16 Dec 2009 07:49:53 GMT<br />Server: Apache<br />Location: https://2hei.net/errorcode/503.html<br />Cache-Control: max-age=0<br />Expires: Wed, 16 Dec 2009 07:49:53 GMT<br />Vary: Accept-Encoding<br />Content-Length: 220<br />Connection: close<br />Content-Type: text/html; charset=iso-8859-1<br />**** CONTENT ****<br />&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;<br />&lt;html&gt;&lt;head&gt;<br />&lt;title&gt;302 Found&lt;/title&gt;<br />&lt;/head&gt;&lt;body&gt;<br />&lt;h1&gt;Found&lt;/h1&gt;<br />&lt;p&gt;The document has moved &lt;a href="https://2hei.net/errorcode/503.html"&gt;here&lt;/a&gt;.&lt;/p&gt;<br />&lt;/body&gt;&lt;/html&gt;<br /><br />HTTP OK - HTTP/1.1 302 Found - 0.030 second response time |time=0.029908s;;;0.000000 size=517B;;;0<br /><br />丫难道是nagios check_http的bug？<br /><br />在仔细看看nagios check_http 用法：<br /><br />Usage: check_http -H &lt;vhost&gt; | -I &lt;IP-address&gt; [-u &lt;uri&gt;] [-p &lt;port&gt;]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-w &lt;warn time&gt;] [-c &lt;critical time&gt;] [-t &lt;timeout&gt;] [-L]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-a auth] [-f &lt;ok | warn | critcal | follow&gt;] [-e &lt;expect&gt;]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-s string] [-l] [-r &lt;regex&gt; | -R &lt;case-insensitive regex&gt;] [-P string]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-m &lt;min_pg_size&gt;:&lt;max_pg_size&gt;] [-4|-6] [-N] [-M &lt;age&gt;] [-A string]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [-k string] [-S] [-C &lt;age&gt;] [-T &lt;content-type&gt;]<br /><br />常用参数<br />-H 用于虚拟主机，并可以增加端口。例如，test.com:10000<br />-I IP地址<br />-S 基于SSL连接。默认端口为443 <br />-u URL地址 “/”<br />-w 警告响应时间 响应时间超过指定时间则显示WARNING<br />-c 临界报警响应时间 响应时间超过设定时间则显示CRITICAL<br />-p 端口设定<br />-e 监测服务器反馈的第一行(状态)信息是否包含匹配字符<br />-N 不读取body部分，在读取header信息，这样相应速度比较快<br />-t 超时时间值 &nbsp;<br />-v 显示服务器反馈的所有信息 <br />-r 正则表达式匹配反馈页信息<br />-R 同上，但可以不考虑大小写问题<br />--invert-regex 反馈信息中包含字符则报警<br />-L 反馈信息包含URL link<br />-a 对需要基础认证的，提供用户名和密码，获取反馈值<br /><br />尝试使用了-e参数，问题搞定！ yeah ！！！<br /><br />-e 指定check_http返回的第一行status中包含的字符串<br />STATUS: HTTP/1.1 302 Found<br /><br />/home/nagios/libexec/check_http -S -H 2hei.net -I 10.10.10.10 -u "/monitor.jsp" -P "" -s "OK"&nbsp; -t 10 -e "200"<br />这样只有返回码包含200的才会OK，其他状态码一律FATAL！<br />最后的command如下：<br />define command{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command_name&nbsp;&nbsp;&nbsp; check_https<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command_line&nbsp;&nbsp;&nbsp; $USER1$/check_http -S -H $ARG1$ -I $HOSTNAME$ -u $ARG2$ -P $ARG3$ -s $ARG4$ -t $ARG5$ -e $ARG6$<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />nagios的check_http果然很牛X。 ]]></description>
            <link>http://www.2hei.net/mt/2009/12/nagios-check-http-302.html</link>
            <guid>http://www.2hei.net/mt/2009/12/nagios-check-http-302.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">check_http</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">nagios</category>
            
            <pubDate>Wed, 16 Dec 2009 16:44:58 +0800</pubDate>
        </item>
        
        <item>
            <title>xenconsole: Could not read tty from store: No such file or directory</title>
            <description><![CDATA[#xem在配置heartbeat时遇到的一个问题，重启虚拟机出现了问题，系统无法启动，控制台也无法登陆。<br />xm console xm-2hei.net<br />xenconsole: Could not read tty from store: No such file or directory<br /><br />原来是xenconsoled进程不在了，重启即可<br />#/usr/sbin/xenconsoled<br /><br />另外一个xen的小tip是，“]”键可以方便的从控制台退出来，哈哈！<br /> ]]></description>
            <link>http://www.2hei.net/mt/2009/11/xenconsole-could-not-read-tty.html</link>
            <guid>http://www.2hei.net/mt/2009/11/xenconsole-could-not-read-tty.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">xen</category>
            
            <pubDate>Fri, 27 Nov 2009 15:47:27 +0800</pubDate>
        </item>
        
        <item>
            <title>Read-only file system on CentOS5 </title>
            <description><![CDATA[We have 5 Dell server collocated running CentOS 4.x and 5.x server operating system. Sometime my file system (ext3) goes read-only. <br />I’d like to know what could be causing such a problem? <br /><br />CentOS 5.x Read-only file system<br /><br />form <a href="http://www.cyberciti.biz/tips/linux-filesytem-goes-read-only.html">http://www.cyberciti.biz/tips/linux-filesytem-goes-read-only.html</a>:<br />a) Hardware problem / hard disk problem, check harddisk for errors.<br /><br />b) High disk I/O aka busy I/O retry error can mark low level disk call as failed. This will force ext3 to go into read only mode.<br /><br />c) High disk I/O on SAN <br /><br />d) SAN is not configured properly for the path failover.<br /><br />In all sort of problems ext3 goes read-only to protect the filesystem and further damage. If you are using VMWARE, check out official webpage to download SCSI patches or workaround for vmware problems. <br />So what could be causing the file system on Linux go read-only?<br /><br />Apart from above generic problem, any other error can trigger filesystem on Linux go read only. I hope our reader / seasoned Linux admin can help to answer this question.<br /><br />reboot my OS , file system recovery.<br /><br />and you can try others:<br />mount -o remount,rw /<br />mount -o remount / ]]></description>
            <link>http://www.2hei.net/mt/2009/11/read-only-file-system-on-cenos5to.html</link>
            <guid>http://www.2hei.net/mt/2009/11/read-only-file-system-on-cenos5to.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
            
            <pubDate>Wed, 25 Nov 2009 11:54:56 +0800</pubDate>
        </item>
        
        <item>
            <title>mptscsih: ioc0: attempting task abort</title>
            <description><![CDATA[<br />Nov 19 00:03:14 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81004f0c7380)<br />Nov 19 00:03:14 2hei.net kernel: sd 0:0:0:0:<br />Nov 19 00:03:14 2hei.net kernel:         command: Read(10): 28 00 00 26 15 d7 00 00 48 00<br />Nov 19 00:03:14 2hei.net kernel: mptbase: ioc0: LogInfo(0x31140000): Originator={PL}, Code={IO Executed}, SubCode(0x0000)<br />Nov 19 00:03:14 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81004f0c7380)<br />Nov 19 00:03:24 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81004f0c7380)<br />Nov 19 00:03:24 2hei.net kernel: sd 0:0:0:0:<br />Nov 19 00:03:24 2hei.net kernel:         command: Test Unit Ready: 00 00 00 00 00 00<br />Nov 19 00:03:25 2hei.net kernel: mptbase: ioc0: LogInfo(0x31130000): Originator={PL}, Code={IO Not Yet Executed}, SubCode(0x0000)<br />Nov 19 00:03:25 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81004f0c7380)<br />Nov 19 00:03:25 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81006dce49c0)<br />Nov 19 00:03:25 2hei.net kernel: sd 0:0:0:0:<br />Nov 19 00:03:25 2hei.net kernel:         command: Write(10): 2a 00 04 c4 a5 f2 00 01 40 00<br />Nov 19 00:12:10 2hei.net kernel: mptbase: ioc0: LogInfo(0x31140000): Originator={PL}, Code={IO Executed}, SubCode(0x0000)<br />Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81006dce49c0)<br />Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81006dce49c0)<br />Nov 19 00:12:11 2hei.net kernel: sd 0:0:0:0:<br />Nov 19 00:12:11 2hei.net kernel:         command: Test Unit Ready: 00 00 00 00 00 00<br />Nov 19 00:12:11 2hei.net kernel: mptbase: ioc0: LogInfo(0x31130000): Originator={PL}, Code={IO Not Yet Executed}, SubCode(0x0000)<br />Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: task abort: SUCCESS (sc=ffff81006dce49c0)<br />Nov 19 00:12:11 2hei.net kernel: mptscsih: ioc0: attempting task abort! (sc=ffff81007f0d4980)<br /><br /><br /><br />Linux 2hei.net.163.com 2.6.18-53.1.13.el5 #1 SMP Tue Feb 12 13:02:30 EST 2008 x86_64 x86_64 x86_64 GNU/Linux<br /><br />[root@2hei.net ~]# cat /proc/scsi/scsi<br />Attached devices:<br />Host: scsi0 Channel: 00 Id: 00 Lun: 00<br />  Vendor: HP       Model: DF072A9844       Rev: HPD0<br />  Type:   Direct-Access                    ANSI SCSI revision: 05<br /><br />[root@2hei.net ~]# modinfo mptsas<br />filename:       /lib/modules/2.6.18-53.1.13.el5/kernel/drivers/message/fusion/mptsas.ko<br />version:        3.04.04<br />license:        GPL<br />description:    Fusion MPT SAS Host driver<br />author:         LSI Logic Corporation<br />srcversion:     D0507BBC402F30BCC5539C0<br />alias:          pci:v00001000d00000062sv*sd*bc*sc*i*<br />alias:          pci:v00001000d00000058sv*sd*bc*sc*i*<br />alias:          pci:v00001000d00000056sv*sd*bc*sc*i*<br />alias:          pci:v00001000d00000054sv*sd*bc*sc*i*<br />alias:          pci:v00001000d00000050sv*sd*bc*sc*i*<br />depends:        mptscsih,mptbase,scsi_mod,scsi_transport_sas<br />vermagic:       2.6.18-53.1.13.el5 SMP mod_unload gcc-4.1<br />parm:           mpt_pt_clear: Clear persistency table: enable=1  (default=MPTSCSIH_PT_CLEAR=0) (int)<br />parm:           max_lun: max lun, default=16895  (int)<br /><br /><br />Do you have acpi=off parameter passed to kernel? Try to set it on.<br />Also, do you use ReiserFS as filesystem?<br /><br />http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c00715023&amp;lang=en&amp;cc=us&amp;taskId=101&amp;prodSeriesId=428936&amp;prodTypeId=15351<br />http://h50176.www5.hp.com/support/292889-291/solve/108727.html<br /><br />]]></description>
            <link>http://www.2hei.net/mt/2009/11/mptscsih-ioc0-attempting-task.html</link>
            <guid>http://www.2hei.net/mt/2009/11/mptscsih-ioc0-attempting-task.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">linux</category>
            
            <pubDate>Mon, 23 Nov 2009 13:43:13 +0800</pubDate>
        </item>
        
        <item>
            <title>linux下用python实现文本menu</title>
            <description><![CDATA[linux用shell实现menu比较简单，今天用python实现了一个，因为python没有switch语法，所以使用了dict来替代，另外调用了linux的clear来清屏，本例只是说明一下简单的实现方法，菜单的命令或者语句可以自由发挥 呵呵。<br /><br />截个图先：<br /><span class="mt-enclosure mt-enclosure-image"><a href="http://www.2hei.net/mt/2009/11/17/2009-11-17-linux-python-menu.png"><img alt="2009-11-17-linux-python-menu.png" src="http://www.2hei.net/mt/2009/11/17/2009-11-17-linux-python-menu-thumb-440x258.png" class="mt-image-left" style="margin: 0pt 20px 20px 0pt; float: left;" height="258" width="440" /></a></span><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />具体代码如下：<br />#!/usr/bin/evn python<br /># -*- coding: utf-8 -*-<br />#Author: 2hei#<a href="http://2hei.net/mt">2hei.net</a><br />#Date: 2009-11-17 18:24<br /><br />import os,sys<br /><br />running = True<br />menu = """<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; menu<br />------------------------------<br />&nbsp;&nbsp;&nbsp; 1:&nbsp;&nbsp; Disk info<br />&nbsp;&nbsp;&nbsp; 2:&nbsp;&nbsp; Mem info<br />&nbsp;&nbsp;&nbsp; 3:&nbsp;&nbsp; Network info<br />&nbsp;&nbsp;&nbsp; 4:&nbsp;&nbsp; Sys load info<br />&nbsp;&nbsp;&nbsp; 5:&nbsp;&nbsp; Process info<br />&nbsp;&nbsp;&nbsp; h:&nbsp;&nbsp; Help<br />&nbsp;&nbsp;&nbsp; q:&nbsp;&nbsp; Quit<br />------------------------------<br />"""<br /><br />menu_dict={<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "h": "echo help ^_^",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "1": "df -h",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "2": "free -m",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "3": "netstat -lnt",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "4": "uptime",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "5": "ps x"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />def commands(args):<br />&nbsp;&nbsp;&nbsp; cmd = menu_dict.get(args)<br />&nbsp;&nbsp;&nbsp; return cmd<br /><br />if __name__ == "__main__":<br />&nbsp;&nbsp;&nbsp; os.system('clear')<br />&nbsp;&nbsp;&nbsp; print menu&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; while running:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd = raw_input("Input your commond :\n")<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if cmd != 'q':<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system('clear')<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print menu<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if commands(cmd) != None:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fo = os.popen(commands(cmd))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print fo.read()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "Input is Wrong!\n"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; except Exception,e:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print menu<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'we will exit the menu\n'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sys.exit()<br /><br /> <div><br /></div>]]></description>
            <link>http://www.2hei.net/mt/2009/11/linux-python-txt-menu.html</link>
            <guid>http://www.2hei.net/mt/2009/11/linux-python-txt-menu.html</guid>
            
                <category domain="http://www.sixapart.com/ns/types#category">OpenSource</category>
            
                <category domain="http://www.sixapart.com/ns/types#category">python</category>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">python</category>
            
            <pubDate>Tue, 17 Nov 2009 18:13:49 +0800</pubDate>
        </item>
        
    </channel>
</rss>
