<?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>Hello, SA &#187; linux</title>
	<atom:link href="http://blog.helosa.org/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.helosa.org</link>
	<description>Could u fix the problem for me ?</description>
	<lastBuildDate>Mon, 06 Sep 2010 06:23:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>微博作弊</title>
		<link>http://blog.helosa.org/2010/06/30/t-163-cheat.html</link>
		<comments>http://blog.helosa.org/2010/06/30/t-163-cheat.html#comments</comments>
		<pubDate>Wed, 30 Jun 2010 07:34:36 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=273</guid>
		<description><![CDATA[鉴于某规定，微博需要考核。 作弊是肯定的，大部分都是这样，我也是。 注册用户这个比较难，我做不了。。。手工注册的。。。 注册马甲了以后，使用以下两条语句，就可以很方便地发推了。 curl -c cookie.txt -d &#8216;username=&#38;password=&#8217; https://reg.163.com/logins.jsp curl -b cookie.txt -d &#8216;status=curl test&#8217; http://t.163.com/statuses/update.do 作弊与否，其实也不管，需要的是一个数字，数字就是绩效。哼 done, that&#8217;s all . ok, KISS .]]></description>
			<content:encoded><![CDATA[<p>鉴于某规定，微博需要考核。</p>
<p>作弊是肯定的，大部分都是这样，我也是。</p>
<p>注册用户这个比较难，我做不了。。。手工注册的。。。</p>
<p>注册马甲了以后，使用以下两条语句，就可以很方便地发推了。</p>
<p>curl -c cookie.txt -d &#8216;username=&amp;password=&#8217; https://reg.163.com/logins.jsp<br />
curl -b cookie.txt -d &#8216;status=curl test&#8217; http://t.163.com/statuses/update.do</p>
<p>作弊与否，其实也不管，需要的是一个数字，数字就是绩效。哼</p>
<p>done, that&#8217;s all . ok, KISS .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/06/30/t-163-cheat.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ubuntu 10.04 初体验</title>
		<link>http://blog.helosa.org/2010/05/05/ubuntu-10-04.html</link>
		<comments>http://blog.helosa.org/2010/05/05/ubuntu-10-04.html#comments</comments>
		<pubDate>Wed, 05 May 2010 08:26:10 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=241</guid>
		<description><![CDATA[想当年，我用的第一个linux 桌面是 fedora 4 ，当时就觉得这个系统实在太爽了，桌面还可以旋转，还有几个很有趣的桌面效果，哈哈，当时的想法就是傻。以致于当时以土黄色为主色调的 ubuntu 6.04 完全不进入我的考虑范围内。但，现在。。。我已经转投 ubuntu 的怀抱了。。。呃。。。唉。。。 其实两者并没有太大的区别，主要就是包管理系统的不同而已，redhat 系和 debian 系，apt-get 的资源明显多于 yum 的资源，这是我背叛 fedora 的主因，其实 ubuntu 的桌面色调我仍然十分讨厌的。 4 月30号就出了，当天就修改源， apt-get dist-upgrade 了。但很不幸，失败了，很多套件使用起来都不正常。。。唉，看来这个跨版本的升级不太靠谱，我以前也失败过，即使成功，有很多东西都是不太稳定的。只好下一个完整的install cd ，刻盘重装吧，什么硬盘重装就不折腾了。 好了，说说 10.04 主要的改进吧，呃，不能说改进，只能说是改变。 1，主色调由土黄色变成了紫色。 本来的色调给人农气的感觉，现在的色调给人艳的感觉，是一种很不喜欢的艳。这个，有点无语，不知道他们怎么想的。。。 2，窗口按钮布局变成了 MAC 系统的布局 也就是，关闭，最大化，最小化，本来是在窗口的顶部右边的，现在位于顶部左边了。UI 设计者是 MAC 爱好者？？幸好我本身对 MAC 也有爱。。。 3，默认im 和 9.10 一样，是 empathy 呃。。。这个不能说不喜欢，它的对话框十分有趣，好像是抄 iphone 的那种。但是，我个人还是比较习惯 pidgin 。。。 4，broadcast 客户端 我一看，傻眼了，都是一些我们国家禁止的互联网应用阿，twitter [...]]]></description>
			<content:encoded><![CDATA[<p>想当年，我用的第一个linux 桌面是 fedora 4 ，当时就觉得这个系统实在太爽了，桌面还可以旋转，还有几个很有趣的桌面效果，哈哈，当时的想法就是傻。以致于当时以土黄色为主色调的 ubuntu 6.04 完全不进入我的考虑范围内。但，现在。。。我已经转投 ubuntu 的怀抱了。。。呃。。。唉。。。</p>
<p>其实两者并没有太大的区别，主要就是包管理系统的不同而已，redhat 系和 debian 系，apt-get 的资源明显多于 yum 的资源，这是我背叛 fedora 的主因，其实 ubuntu 的桌面色调我仍然十分讨厌的。</p>
<p>4 月30号就出了，当天就修改源， apt-get dist-upgrade 了。但很不幸，失败了，很多套件使用起来都不正常。。。唉，看来这个跨版本的升级不太靠谱，我以前也失败过，即使成功，有很多东西都是不太稳定的。只好下一个完整的install cd ，刻盘重装吧，什么硬盘重装就不折腾了。</p>
<p>好了，说说 10.04 主要的改进吧，呃，不能说改进，只能说是改变。</p>
<p>1，主色调由土黄色变成了紫色。</p>
<p>本来的色调给人农气的感觉，现在的色调给人艳的感觉，是一种很不喜欢的艳。这个，有点无语，不知道他们怎么想的。。。</p>
<p>2，窗口按钮布局变成了 MAC 系统的布局</p>
<p>也就是，关闭，最大化，最小化，本来是在窗口的顶部右边的，现在位于顶部左边了。UI 设计者是 MAC 爱好者？？幸好我本身对 MAC 也有爱。。。</p>
<p>3，默认im 和 9.10 一样，是 empathy</p>
<p>呃。。。这个不能说不喜欢，它的对话框十分有趣，好像是抄 iphone 的那种。但是，我个人还是比较习惯 pidgin 。。。</p>
<p>4，broadcast 客户端</p>
<p>我一看，傻眼了，都是一些我们国家禁止的互联网应用阿，twitter , facebook 等，哈哈。而且我也没发现它可以设置代理。。。难道要我挂着 vpn 来上么？</p>
<p>5，默认黑色 theme</p>
<p>这个好像 9.10 也是的了，难道。。。觉得黑色的 theme 有型一点？</p>
<p>6，gnome-terminal 透明</p>
<p>这点不错，让我知道知道后面的程序的情况，例如windows 有人联系我，im 工具在闪，呵呵</p>
<p>7，开机关机速度</p>
<p>开机速度据说是经过优化的了，个人感觉不大。新装的系统嘛，通常是比较快的。。。关机速度倒是不错，比我原来的关机快多了。。。当然，也有可能是我原来的系统载入了太多垃圾。。。</p>
<p>才试用了几天，就先说这些把。总的来说，10.04 还是不错的，哈哈。桌面来说，还是选择 ubuntu 吧！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/05/05/ubuntu-10-04.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>可恨的chrome!</title>
		<link>http://blog.helosa.org/2010/04/15/chrome-network.html</link>
		<comments>http://blog.helosa.org/2010/04/15/chrome-network.html#comments</comments>
		<pubDate>Thu, 15 Apr 2010 14:49:22 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=226</guid>
		<description><![CDATA[chrome 其实是一个挺好的浏览器来的，在 windows 上我经常使用它（但本人不是经常使用 windows ）。但这两天它带给我很大的困扰，恨死它了！！！ chrome 有 linux 版，已经是很久以前的事了，我就 download 来玩玩，平时也很少用，恰好昨天有个东西要测试，要访问杭州的节点，于是我就拿它出来，并设了一下代理服务器，在杭州搭了个 squid ，就把代理服务器设到杭州了。 印象中，以前所谓的 linux 下的 chrome 是 chromium ，这个是无法配置代理服务器的，而 官方一点的 chrome ，已经具有这个功能了，options -&#62; under the hood -&#62; change proxy settings ，就可以设置代理服务器了。杯具就是这样产生的了！！ 我用完代理后，就顺手把 chrome 给关了，proxy setting 当然是没有改回来。 然后，从昨天一直到现在，我使用起网络来，都是怪怪的！！如： $ curl -I lady.163.com HTTP/1.1 200 OK Date: Thu, 15 Apr 2010 14:44:38 GMT Server: Apache/2.2.11 [...]]]></description>
			<content:encoded><![CDATA[<p>chrome 其实是一个挺好的浏览器来的，在 windows 上我经常使用它（但本人不是经常使用 windows ）。但这两天它带给我很大的困扰，恨死它了！！！</p>
<p>chrome 有 linux 版，已经是很久以前的事了，我就 download 来玩玩，平时也很少用，恰好昨天有个东西要测试，要访问杭州的节点，于是我就拿它出来，并设了一下代理服务器，在杭州搭了个 squid ，就把代理服务器设到杭州了。</p>
<p>印象中，以前所谓的 linux 下的 chrome 是 chromium ，这个是无法配置代理服务器的，而 官方一点的 chrome ，已经具有这个功能了，options -&gt; under the hood -&gt; change proxy settings ，就可以设置代理服务器了。杯具就是这样产生的了！！</p>
<p>我用完代理后，就顺手把 chrome 给关了，proxy setting 当然是没有改回来。</p>
<p>然后，从昨天一直到现在，我使用起网络来，都是怪怪的！！如：</p>
<p>$ curl -I lady.163.com</p>
<p>HTTP/1.1 200 OK<br />
Date: Thu, 15 Apr 2010 14:44:38 GMT<br />
Server: Apache/2.2.11 (Unix) PHP/5.3.0<br />
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT<br />
ETag: &#8220;2006c2a0-2c-3e9564c23b600&#8243;<br />
Accept-Ranges: bytes<br />
Content-Length: 44<br />
Content-Type: text/html</p>
<p>oh , my god !!</p>
<p>再来！</p>
<p>$ sudo apt-get update ;</p>
<p>Ign http://mirrors.163.com karmic Release.gpg<br />
Ign http://mirrors.163.com karmic/main Translation-en_US<br />
Ign http://mirrors.163.com karmic/restricted Translation-en_US<br />
Ign http://mirrors.163.com karmic/multiverse Translation-en_US<br />
Ign http://mirrors.163.com karmic/universe Translation-en_US<br />
Ign http://mirrors.163.com karmic Release<br />
Ign http://mirrors.163.com karmic/main Packages<br />
Ign http://mirrors.163.com karmic/restricted Packages<br />
Ign http://mirrors.163.com karmic/multiverse Packages<br />
Ign http://mirrors.163.com karmic/universe Packages<br />
Ign http://mirrors.163.com karmic/main Packages<br />
Ign http://mirrors.163.com karmic/restricted Packages<br />
Ign http://mirrors.163.com karmic/multiverse Packages<br />
Ign http://mirrors.163.com karmic/universe Packages<br />
Err http://mirrors.163.com karmic/main Packages<br />
404  Not Found<br />
Err http://mirrors.163.com karmic/restricted Packages<br />
404  Not Found<br />
Err http://mirrors.163.com karmic/multiverse Packages<br />
404  Not Found<br />
Err http://mirrors.163.com karmic/universe Packages<br />
404  Not Found<br />
W: Failed to fetch http://mirrors.163.com/ubuntu/dists/karmic/main/binary-i386/Packages.gz  404  Not Found</p>
<p>W: Failed to fetch http://mirrors.163.com/ubuntu/dists/karmic/restricted/binary-i386/Packages.gz  404  Not Found</p>
<p>W: Failed to fetch http://mirrors.163.com/ubuntu/dists/karmic/multiverse/binary-i386/Packages.gz  404  Not Found</p>
<p>W: Failed to fetch http://mirrors.163.com/ubuntu/dists/karmic/universe/binary-i386/Packages.gz  404  Not Found</p>
<p>E: Some index files failed to download, they have been ignored, or old ones used instead.</p>
<p>oh!! no !!!!<br />
我一直百思不得其解！！但又太忙，就不管它了，不能curl ，就ssh 上随便一台服务器 curl 呗。而且，只要我 su 到 root ，就可以正常使用了！！我曾经怀疑，是有人黑了我的 curl 。。。还重装了 curl 呢。。。但还是出错，真是神奇了。。。</p>
<p>直到刚才，实在忍无可忍了！我决定彻查原因！！终于被我通过下面这条命令知道原因了！！</p>
<p>$ wget -S &#8211;spider lady.163.com<br />
Spider mode enabled. Check if remote file exists.<br />
&#8211;2010-04-15 22:48:01&#8211;  http://lady.163.com/<br />
Connecting to 60.12.80.115:3128&#8230; connected.<br />
Proxy request sent, awaiting response&#8230;<br />
HTTP/1.1 200 OK<br />
Date: Thu, 15 Apr 2010 14:48:01 GMT<br />
Server: Apache/2.2.11 (Unix) PHP/5.3.0<br />
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT<br />
ETag: &#8220;2006c2a0-2c-3e9564c23b600&#8243;<br />
Accept-Ranges: bytes<br />
Content-Length: 44<br />
Connection: close<br />
Content-Type: text/html<br />
Length: 44 [text/html]<br />
Remote file exists and could contain further links,<br />
but recursion is disabled &#8212; not retrieving.</p>
<p>fuck !! 60.12.80.115:3128 是我在杭州的代理！！原来修改 chrome 的 network 配置，还影响了我平时的网络使用！！fuck !!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/04/15/chrome-network.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>debian 下 ssh 更改 gnome-terminal 的 title</title>
		<link>http://blog.helosa.org/2010/04/12/gnome-terminal-title.html</link>
		<comments>http://blog.helosa.org/2010/04/12/gnome-terminal-title.html#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:15:37 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=215</guid>
		<description><![CDATA[我的工作环境，一般在 rh 系和 debian 系中切换，毕竟是不同的产品，细微的不同很容易令到人昏头转向的。我的工作用机，ubuntu，gnome-terminal 就是我的日常必备工具了，而使用 gnome-terminal ssh 上rh 和 debian 的机器，就可以通过gnome terminal 的 title ，很快分辨出我登录的是哪个系统的机器了。 如：ssh rh 的机器，title 显示的是 &#8221; lazybug@yz12-67 ~ &#8221; ，这个是远程的系统信息。而登录 debian 的机器呢，显示 &#8221; czbug@thinkpad-laptop: ~ &#8220;，无论登录哪台，都是一样的显示，因为这是本地的。 关键在于 shell 的一个变量，可以通过命令 set 看到（env 和 set 是有区别的，详情请 google ）： PROMPT_COMMAND=&#8217;echo -ne &#8220;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007&#8243;&#8216; rh 是有上面这个变量的，而 debian 没有。 好了，如果我们想让 debian 也像rh 那样显示呢？？加上这个变量呗，在 /etc/profile 里加上下面这段： case [...]]]></description>
			<content:encoded><![CDATA[<p>我的工作环境，一般在 rh 系和 debian 系中切换，毕竟是不同的产品，细微的不同很容易令到人昏头转向的。我的工作用机，ubuntu，gnome-terminal 就是我的日常必备工具了，而使用 gnome-terminal ssh 上rh 和 debian 的机器，就可以通过gnome terminal 的 title ，很快分辨出我登录的是哪个系统的机器了。</p>
<p>如：ssh rh 的机器，title 显示的是 &#8221; lazybug@yz12-67 ~ &#8221; ，这个是远程的系统信息。而登录 debian 的机器呢，显示 &#8221; czbug@thinkpad-laptop: ~ &#8220;，无论登录哪台，都是一样的显示，因为这是本地的。</p>
<p>关键在于 shell 的一个变量，可以通过命令 set 看到（env 和 set 是有区别的，详情请 google ）：</p>
<p>PROMPT_COMMAND=&#8217;echo -ne &#8220;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007&#8243;&#8216;</p>
<p>rh 是有上面这个变量的，而 debian 没有。</p>
<p>好了，如果我们想让 debian 也像rh 那样显示呢？？加上这个变量呗，在 /etc/profile 里加上下面这段：</p>
<p>case $TERM in<br />
(xterm*)<br />
PROMPT_COMMAND=&#8217;echo -ne &#8220;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007&#8243;&#8216;<br />
;;<br />
esac<br />
没有root 权限的话，加在 ~/.profile 也行</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/04/12/gnome-terminal-title.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>利用 piranha 快速搭建 lvs</title>
		<link>http://blog.helosa.org/2010/03/18/piranha-lvs.html</link>
		<comments>http://blog.helosa.org/2010/03/18/piranha-lvs.html#comments</comments>
		<pubDate>Thu, 18 Mar 2010 13:04:15 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvs]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=191</guid>
		<description><![CDATA[最近为那个公司很重视的项目搭建 lvs ，在这里 log 一下吧。 利用red hat 提供的 piranha ，简单快捷。 我选择的是 centos 5.4 ，安装 piranha ，很简单 yum install piranha 此时，它还需要你安装 ipvsadm , php , php-cli , php-common , httpd ，piranha 是一个 web 管理的工具，没办法，虽然我不用web 界面，但这些在yum 下还是必须装上的。 装完以后，/etc/sysconfig/ha/lvs.cf 还是空的，我去抄一份过来。 serial_no = 1 primary = 60.12.227.1 service = lvs backup_active = 1 backup = 60.12.227.2 heartbeat = 1 [...]]]></description>
			<content:encoded><![CDATA[<p>最近为那个公司很重视的项目搭建 lvs ，在这里 log 一下吧。</p>
<p>利用red hat 提供的 piranha ，简单快捷。</p>
<p>我选择的是 centos 5.4 ，安装 piranha ，很简单</p>
<p>yum install piranha</p>
<p>此时，它还需要你安装 ipvsadm , php , php-cli , php-common , httpd ，piranha 是一个 web 管理的工具，没办法，虽然我不用web 界面，但这些在yum 下还是必须装上的。</p>
<p>装完以后，/etc/sysconfig/ha/lvs.cf 还是空的，我去抄一份过来。</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">serial_no = 1
primary = 60.12.227.1
service = lvs
backup_active = 1
backup = 60.12.227.2
heartbeat = 1
heartbeat_port = 10001
keepalive = 6
deadtime = 18
network = direct
debug_level = NONE
virtual vs[1] {
    active = 1
    address = 60.12.227.200 eth0:200
    vip_nmask = 255.255.255.0
    port = 80
    send = &quot;GET / HTTP/1.0\r\n\r\n&quot;
    expect = &quot;HTTP&quot;
    use_regex = 0
    load_monitor = none
    scheduler = wlc
    protocol = tcp
    timeout = 6
    reentry = 15
    quiesce_server = 0
    server rs[1] {
    address = 192.168.0.1
        active = 1
        weight = 2
    }
    server rs[2] {
    address = 192.168.0.2
        active = 1
        weight = 2
    }
}</pre></div></div>

<p>到此，lvs 的 director 端，算是安装完成了。</p>
<p>有人会问了，为什么我没有修改 /proc/sys/net/ipv4/ip_forward 为1 。其实，这里我也还不是很懂，理论上，转发是必须设为1 的，但我发现，貌似不设，也可以正常工作，难道是 piranha 的关系？？</p>
<p>然后就是配置 real server 端了。</p>
<p>我又抄一个shell 过来</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">VIP</span>=60.12.227.200
<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> lo:<span style="color: #000000;">0</span> <span style="color: #007800;">$VIP</span> broadcast <span style="color: #007800;">$VIP</span> netmask 255.255.255.255 up
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>lo<span style="color: #000000; font-weight: bold;">/</span>arp_ignore
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>lo<span style="color: #000000; font-weight: bold;">/</span>arp_announce
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>all<span style="color: #000000; font-weight: bold;">/</span>arp_ignore
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>all<span style="color: #000000; font-weight: bold;">/</span>arp_announce</pre></div></div>

<p>由于我的director 端配置的是 dr 模式，所以必须关闭arp 响应。</p>
<p>执行一下这个shell，real server 端也算是完成了。</p>
<p>启动 director 端：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/pulse start</span>
Starting pulse:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>查看服务状态：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ipvsadm -ln</span>
&nbsp;
IP Virtual Server version 1.2.1 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">size</span></span>=<span style="color: #000000;">4096</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Prot LocalAddress:Port Scheduler Flags
-<span style="color: #000000; font-weight: bold;">&gt;</span> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  60.12.227.200:<span style="color: #000000;">80</span> wlc
-<span style="color: #000000; font-weight: bold;">&gt;</span> 192.168.0.1:<span style="color: #000000;">80</span>             Route   <span style="color: #000000;">2</span>      <span style="color: #000000;">326</span>        <span style="color: #000000;">172</span>
-<span style="color: #000000; font-weight: bold;">&gt;</span> 192.168.0.2:<span style="color: #000000;">80</span>             Route   <span style="color: #000000;">2</span>      <span style="color: #000000;">326</span>        <span style="color: #000000;">192</span></pre></div></div>

<p>搭建完成了，算是比较快速的了，呵呵。还有一点知识点的，下回再说吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/03/18/piranha-lvs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ssh-agent 的安全隐患</title>
		<link>http://blog.helosa.org/2010/03/07/ssh-agent-secure.html</link>
		<comments>http://blog.helosa.org/2010/03/07/ssh-agent-secure.html#comments</comments>
		<pubDate>Sat, 06 Mar 2010 18:38:23 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=185</guid>
		<description><![CDATA[ssh 是SA 的一大利器，登录服务器、翻墙。。。ssh 通常都配合着 ssh-agent 来使用，ssh-agent 是个管理 private key 的 passphrase 的工具，启动 ssh-agent 后，执行一次 ssh-add ，此时需要输入一次 private key 的 passphrase ，输入正确后，passphrase 就归 ssh-agent 管理，往后的 ssh 操作，就不需要询问 passphrase 了。这里需要注意，ssh 必须开启了forwardagent ，一劳永逸的方法，就是在 /etc/ssh/ssh_config 中把#ForwardAgent no 去掉注释，并改为 ForwardAgent yes。 重点说说它的安全隐患。 ssh-agent 工作过程中会创建一个 socket 文件在 /tmp 目录里，如 /tmp/ssh-jlhtX14952/agent.14952 。我们需要使用 ssh-agent 时，运行一下 ssh-add ，把 private key 加入到 ssh-agent 中管理，此时，是需要输入一次 passphrase [...]]]></description>
			<content:encoded><![CDATA[<p>ssh 是SA 的一大利器，登录服务器、翻墙。。。ssh 通常都配合着 ssh-agent 来使用，ssh-agent 是个管理 private key 的 passphrase 的工具，启动 ssh-agent 后，执行一次 ssh-add ，此时需要输入一次 private key 的 passphrase ，输入正确后，passphrase 就归 ssh-agent 管理，往后的 ssh 操作，就不需要询问 passphrase 了。这里需要注意，ssh 必须开启了forwardagent ，一劳永逸的方法，就是在 /etc/ssh/ssh_config 中把#ForwardAgent no 去掉注释，并改为 ForwardAgent yes。</p>
<p>重点说说它的安全隐患。</p>
<p>ssh-agent 工作过程中会创建一个 socket 文件在 /tmp 目录里，如 /tmp/ssh-jlhtX14952/agent.14952 。我们需要使用 ssh-agent 时，运行一下 ssh-add ，把 private key 加入到 ssh-agent 中管理，此时，是需要输入一次 passphrase 的，当输入正确了以后，往后都不需要输入 passphrase 了。任何用户，只要连接上这个socket ，就可以使用已经加入到ssh-agent 管理的 private key 了，而且不需要输入 passphrase 。所以，这个 socket 的权限是 600 ，如：</p>
<div id=":16o">srw&#8212;&#8212;-  1 raymond raymond 0 May  1  2009 /tmp/ssh-jlhtX14952/agent.14952<br />
但是。。。我们的 root ，是可以随意访问的。。。</div>
<div></div>
<div>这里演示一次！<br />
1，用root 连接socket，这里很简单，就执行一句话<br />
# SSH_AUTH_SOCK=/tmp/ssh-jlhtX14952/agent.14952; export SSH_AUTH_SOCK;</p>
<div id=":16o">
2, 查看此 socket 是否已经加入了 private key<br />
# ssh-add -l<br />
1024 fa:2d:87:1a:c5:a6:9d:7c:67:eb:51:a3:6a:7b:49:34 /home/raymond/.ssh/identity (RSA)<br />
看，raymond 的 key 已经加入进去了</p>
<p>3，尝试登录raymond 的服务器，以root 的身份，但使用 raymond 的 key<br />
# ssh <a href="mailto:raymond@220.181.8.32" target="_blank">raymond@220.181.xxx.xxx</a><br />
Last login: Sat Mar  6 04:41:55 2010 from 220.181.xxx.xxx<br />
[raymond@VM ~]$ whoami<br />
raymond<br />
看，此时，已经是以raymond 的身份登录的服务器了</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/03/07/ssh-agent-secure.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>pmap : 理解linux的进程内存占用</title>
		<link>http://blog.helosa.org/2010/02/26/pmap-process-memory.html</link>
		<comments>http://blog.helosa.org/2010/02/26/pmap-process-memory.html#comments</comments>
		<pubDate>Thu, 25 Feb 2010 17:53:54 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=165</guid>
		<description><![CDATA[看了几篇文章，对linux的进程的内存占用，又有了一点认识，记录一下。 首先 ps 看一下我的系统跑着哪些process $ ps aux &#160; USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND ... czbug     1980  0.0  1.7 180472 34416 ?        Sl   Feb25   0:01 /usr/bin/yakuake ... 我拿 yakuake 这个小程序作例子。 其中，关于内存的是 VSZ 和 RSS 这两个 man ps 看看它们的含义： rss       RSS    resident set size, the non-swapped physical memory that a task [...]]]></description>
			<content:encoded><![CDATA[<p>看了几篇文章，对linux的进程的内存占用，又有了一点认识，记录一下。</p>
<p>首先 ps 看一下我的系统跑着哪些process</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ps</span> aux
&nbsp;
USER       PID <span style="color: #000000; font-weight: bold;">%</span>CPU <span style="color: #000000; font-weight: bold;">%</span>MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
czbug     <span style="color: #000000;">1980</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">1.7</span> <span style="color: #000000;">180472</span> <span style="color: #000000;">34416</span> ?        Sl   Feb25   <span style="color: #000000;">0</span>:01 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>yakuake
...</pre></div></div>

<p>我拿 yakuake 这个小程序作例子。</p>
<p>其中，关于内存的是 VSZ 和 RSS 这两个</p>
<p>man ps 看看它们的含义：</p>
<blockquote><p>
rss       RSS    resident set size, the non-swapped physical memory that a task has used (in kiloBytes). (alias rssize, rsz).</p>
<p>vsz       VSZ    virtual memory size of the process in KiB (1024-byte units). Device mappings are currently excluded; this is subject to change. (alias vsize).
</p></blockquote>
<p>简单一点说，RSS 就是这个process 实际占用的物理内存，VSZ 就是process 的虚拟内存，就是process 现在没有使用但未来可能会分配的内存大小。</p>
<p>其实这里的ps 出来的结果，是有点不正确的，如果把所有程序的 RSS 加起来，恐怕比你的实际内存还要大呢。为什么呢？？因为 ps 的结果，RSS 那部分，是包括共享内存的。这里我用 pmap 来看看。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ pmap <span style="color: #660033;">-d</span> <span style="color: #000000;">1980</span>
&nbsp;
<span style="color: #000000;">1980</span>:   <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>yakuake
Address   Kbytes Mode  Offset           Device    Mapping
00110000    <span style="color: #000000;">2524</span> r-x-- 0000000000000000 008:00002 libkio.so.5.3.0
00387000       <span style="color: #000000;">4</span> <span style="color: #660033;">-----</span> 0000000000277000 008:00002 libkio.so.5.3.0
00388000      <span style="color: #000000;">32</span> r---- 0000000000277000 008:00002 libkio.so.5.3.0
00390000      <span style="color: #000000;">16</span> rw--- 000000000027f000 008:00002 libkio.so.5.3.0
00394000     <span style="color: #000000;">444</span> r-x-- 0000000000000000 008:00002 libQtDBus.so.4.5.2
00403000       <span style="color: #000000;">4</span> <span style="color: #660033;">-----</span> 000000000006f000 008:00002 libQtDBus.so.4.5.2
00404000       <span style="color: #000000;">4</span> r---- 000000000006f000 008:00002 libQtDBus.so.4.5.2
00405000       <span style="color: #000000;">4</span> rw--- 0000000000070000 008:00002 libQtDBus.so.4.5.2
00407000     <span style="color: #000000;">228</span> r-x-- 0000000000000000 008:00002 libkparts.so.4.3.0
00440000       <span style="color: #000000;">8</span> r---- 0000000000039000 008:00002 libkparts.so.4.3.0
00442000       <span style="color: #000000;">4</span> rw--- 000000000003b000 008:00002 libkparts.so.4.3.0
00443000    <span style="color: #000000;">3552</span> r-x-- 0000000000000000 008:00002 libkdeui.so.5.3.0
007bb000      <span style="color: #000000;">76</span> r---- 0000000000377000 008:00002 libkdeui.so.5.3.0
007ce000      <span style="color: #000000;">24</span> rw--- 000000000038a000 008:00002 libkdeui.so.5.3.0
007d4000       <span style="color: #000000;">4</span> rw--- 0000000000000000 000:00000   <span style="color: #7a0874; font-weight: bold;">&#91;</span> anon <span style="color: #7a0874; font-weight: bold;">&#93;</span>
....
mapped: 180472K    writeable<span style="color: #000000; font-weight: bold;">/</span>private: 19208K    shared: 20544K</pre></div></div>

<p>我略去了一部分输出，都是差不多的，重点在最后那行输出。</p>
<p>linux 会把一些shared libraries 载入到内存中，在pmap 的输出中，这些shared libraries 的名字通常是 lib*.so 。如 libX11.so.6.2.0 。这个 libX11.so.6.2.0 会被很多process load 到自己的运行环境中，同时，ps 输出的RSS 结果中，每个process 都包含了这个libX11.so.6.2.0 ，而事实上它只被load 了一次，如果单纯把ps 的结果相加，这样就重复计算了。</p>
<p>而 pmap 的输出中，writeable/private: 19208K ，这个就是yakuake 这个程序真正占用的物理内存，不包含shared libraries 。在这里，它只有19208K，而ps 的RSS 是34416K。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>我在看这方面的资料时，还看到一些关于virtual memory 的，再记录下。</p>
<p>以下两个命令均可查看 vmsize 。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/&lt;</span>pid<span style="color: #000000; font-weight: bold;">&gt;/</span><span style="color: #c20cb9; font-weight: bold;">stat</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $23 / 1024}'</span>
$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/&lt;</span>pid<span style="color: #000000; font-weight: bold;">&gt;/</span>status <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> vmsize</pre></div></div>

<p>一般来说，得出来的值，是和 ps 的 VSZ 是一样的，但有一种情况例外，就是查看X server 的时候。</p>
<p>举个例：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ps</span> aux<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>X<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span>   <span style="color: #666666; font-style: italic;"># 得出X server 的 pid   ...</span>
<span style="color: #000000;">1076</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1076</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">stat</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $23 / 1024}'</span>
<span style="color: #000000;">139012</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1076</span><span style="color: #000000; font-weight: bold;">/</span>status <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> vmsize
VmSize:      <span style="color: #000000;">106516</span> kB</pre></div></div>

<p>而 ps 的 VSZ 为 106516 ，与后者是一致的。</p>
<p>据说是因为</p>
<p>VmSize = memory + memory-mapped hardware (e.g. video card memory).</p>
<p>这句话我不是很理解。。。就不作解释了。。。</p>
<p>对OS 的理解还很肤浅，还需努力啊。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/02/26/pmap-process-memory.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ntpdate(no server suitable for synchronization found)</title>
		<link>http://blog.helosa.org/2010/02/11/ntpdate-no-server-suitable-for-synchronization-found.html</link>
		<comments>http://blog.helosa.org/2010/02/11/ntpdate-no-server-suitable-for-synchronization-found.html#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:25:57 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=82</guid>
		<description><![CDATA[今天维护一个集群系统时，被人报障说集群的机器时间不对。。。我去看了一下，crontab 里有对时的命令啊。再手动执行一下，才发现，原来被我设的防火墙给墙住了。。。机器只允许特定的外网ip访问，内网无限制。。。所以ntpdate 外面一些对时服务器的时候，根本不会收到返回了。 话说这个防火墙，也是其它部门的同事建议我设的，本部门的程序员对安全这些事情好不上心的，专心于系统功能的开发，甚至连我多次建议的系统管理经验也不采纳。算了，none of my business 。 而他们说这个系统对时，很急，要不集群间的机器heartbeat 时间不对，就会以为对方挂了的了。 那我就马上在另一台对外网无限制的机器上搭一个ntpd ，就作为一个对时服务器的代理吧。 安装ntpd，这个很简单，那台机器是 centos 5，那就用yum。 #yum install ntp 装好还不能用呢，最快速度使用上的话，那就只修改一行配置，因为默认是只允许本地对时而已，我们必须加上内网都可以对时 #vi /etc/ntp.conf 把下面这行，取消注释，并加上自己网段的相关信息即可 #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 如： restrict 10.100.20.0 mask 255.255.255.0 nomodify notrap 然后重启ntp /etc/init.d/ntpd restart 重启成功后，如果你立刻想对时的话，是会报错的，如： #ntpdate 10.100.20.59 # 就是我刚配的ntpd server 11 Feb 00:37:36 ntpdate&#91;22276&#93;: no server suitable for synchronization found 这种错误，应该是没有ntpd [...]]]></description>
			<content:encoded><![CDATA[<p>今天维护一个集群系统时，被人报障说集群的机器时间不对。。。我去看了一下，crontab 里有对时的命令啊。再手动执行一下，才发现，原来被我设的防火墙给墙住了。。。机器只允许特定的外网ip访问，内网无限制。。。所以ntpdate 外面一些对时服务器的时候，根本不会收到返回了。</p>
<p>话说这个防火墙，也是其它部门的同事建议我设的，本部门的程序员对安全这些事情好不上心的，专心于系统功能的开发，甚至连我多次建议的系统管理经验也不采纳。算了，none of my business 。</p>
<p>而他们说这个系统对时，很急，要不集群间的机器heartbeat 时间不对，就会以为对方挂了的了。</p>
<p>那我就马上在另一台对外网无限制的机器上搭一个ntpd ，就作为一个对时服务器的代理吧。</p>
<p>安装ntpd，这个很简单，那台机器是 centos 5，那就用yum。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#yum install ntp</span></pre></div></div>

<p>装好还不能用呢，最快速度使用上的话，那就只修改一行配置，因为默认是只允许本地对时而已，我们必须加上内网都可以对时</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#vi /etc/ntp.conf</span></pre></div></div>

<p>把下面这行，取消注释，并加上自己网段的相关信息即可</p>
<p>#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap</p>
<p>如：</p>
<p>restrict 10.100.20.0 mask 255.255.255.0 nomodify notrap</p>
<p>然后重启ntp</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>ntpd restart</pre></div></div>

<p>重启成功后，如果你立刻想对时的话，是会报错的，如：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#ntpdate 10.100.20.59 # 就是我刚配的ntpd server</span>
<span style="color: #000000;">11</span> Feb 00:<span style="color: #000000;">37</span>:<span style="color: #000000;">36</span> ntpdate<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">22276</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: no server suitable <span style="color: #000000; font-weight: bold;">for</span> synchronization found</pre></div></div>

<p>这种错误，应该是没有ntpd server 才会报的啊，究竟为什么呢？？</p>
<p>原来，如果ntpd server 没有进行过对时的话，也是会报这个错的。。。很汗，为什么不写得明白一点呢？？</p>
<p>好了，既然知道原因，只需要等待数分钟，让我的ntpd server 10.100.20.59 自己去对了一次时后，我们再操作，就会成功的了。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ntpdate 10.100.20.59</span>
<span style="color: #000000;">11</span> Feb 00:<span style="color: #000000;">41</span>:<span style="color: #000000;">30</span> ntpdate<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">22323</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: adjust <span style="color: #000000; font-weight: bold;">time</span> server 10.100.20.59 offset -<span style="color: #000000;">0.005792</span> sec</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/02/11/ntpdate-no-server-suitable-for-synchronization-found.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn update 时出错（Valid UTF-8 data）</title>
		<link>http://blog.helosa.org/2010/02/11/svn-update-valid-utf-8-data.html</link>
		<comments>http://blog.helosa.org/2010/02/11/svn-update-valid-utf-8-data.html#comments</comments>
		<pubDate>Wed, 10 Feb 2010 16:34:19 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=80</guid>
		<description><![CDATA[今天svn up的时候，发现一个报错： #svn up svn: Valid UTF-8 data &#40;hex:&#41; followed by invalid UTF-8 sequence &#40;hex: a1 b0&#41; 突然爆出的错误。。。google 了一下，这个比较靠谱 http://ryanerwin.com/2007/04/09/valid-utf-8-data-hex-followed-by-invalid-utf-8-sequence/ 大意是说，你的svn工作目录，有了一个不能由当前系统的字符集识别的文件。 解决方式是：删了这些文件。 ok,那我去删咯，确实有一个目录下，有一个?????????????? 的文件，gbk 编码的文件。。。 怎么出现的呢？？不会是被某位大哥黑进来的吧，哈哈。 不追查了，就当是跑脚本失败生成的。删去，问题解决了！]]></description>
			<content:encoded><![CDATA[<p>今天svn up的时候，发现一个报错：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#svn up</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span>: Valid UTF-<span style="color: #000000;">8</span> data
<span style="color: #7a0874; font-weight: bold;">&#40;</span>hex:<span style="color: #7a0874; font-weight: bold;">&#41;</span>
followed by invalid UTF-<span style="color: #000000;">8</span> sequence
<span style="color: #7a0874; font-weight: bold;">&#40;</span>hex: a1 b0<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>突然爆出的错误。。。google 了一下，这个比较靠谱</p>
<p>http://ryanerwin.com/2007/04/09/valid-utf-8-data-hex-followed-by-invalid-utf-8-sequence/</p>
<p>大意是说，你的svn工作目录，有了一个不能由当前系统的字符集识别的文件。<br />
解决方式是：删了这些文件。</p>
<p>ok,那我去删咯，确实有一个目录下，有一个?????????????? 的文件，gbk 编码的文件。。。</p>
<p>怎么出现的呢？？不会是被某位大哥黑进来的吧，哈哈。</p>
<p>不追查了，就当是跑脚本失败生成的。删去，问题解决了！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/02/11/svn-update-valid-utf-8-data.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx proxy_pass 里的&#8221;/&#8221;</title>
		<link>http://blog.helosa.org/2010/02/10/nginx-proxy_pass.html</link>
		<comments>http://blog.helosa.org/2010/02/10/nginx-proxy_pass.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 18:09:57 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://lazybug.me/?p=74</guid>
		<description><![CDATA[见配置，摘自nginx.conf 里的server 段： server { listen 80; server_name abc.163.com ; location / { proxy_pass http://ent.163.com/ ; } location /star/ { proxy_pass http://ent.163.com ; } } 里面有两个location，我先说第一个，/ 。其实这里有两种写法，分别是： location / { proxy_pass http://ent.163.com/ ; } location / { proxy_pass http://ent.163.com ; } 出来的效果都一样的。 第二个location，/star/。同样两种写法都有，都出来的结果，就不一样了。 location /star/ { proxy_pass http://ent.163.com ; } 当访问 http://abc.163.com/star/ 的时候，nginx 会代理访问到 http://ent.163.com/star/ [...]]]></description>
			<content:encoded><![CDATA[<p>见配置，摘自nginx.conf 里的server 段：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">server {
<span style="color: #00007f;">listen</span> <span style="color: #ff0000;">80</span>;
server_name abc.163.com ;
<span style="color: #00007f;">location</span> / {
proxy_pass http://ent.163.com/ ;
}
<span style="color: #00007f;">location</span> /star/ {
proxy_pass http://ent.163.com ;
}
}</pre></div></div>

<p>里面有两个location，我先说第一个，/ 。其实这里有两种写法，分别是：</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">location</span> / {
proxy_pass http://ent.163.com/ ;
}</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">location</span> / {
proxy_pass http://ent.163.com ;
}</pre></div></div>

<p>出来的效果都一样的。</p>
<p>第二个location，/star/。同样两种写法都有，都出来的结果，就不一样了。</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">location</span> /star/ {
proxy_pass http://ent.163.com ;
}</pre></div></div>

<p>当访问 http://abc.163.com/star/ 的时候，nginx 会代理访问到 http://ent.163.com/star/ ，并返回给我们。</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">location</span> /star/ {
proxy_pass http://ent.163.com/ ;
}</pre></div></div>

<p>当访问 http://abc.163.com/star/ 的时候，nginx 会代理访问到 http://ent.163.com/ ，并返回给我们。</p>
<p>这两段配置，分别在于， proxy_pass http://ent.163.com<span style="color: #ff0000;">/</span> ; 这个&#8221;/&#8221;，令到出来的结果完全不同。</p>
<p>前者，相当于告诉nginx，我这个location，是代理访问到http://ent.163.com 这个server的，我的location是什么，nginx 就把location 加在proxy_pass 的 server 后面，这里是/star/，所以就相当于 http://ent.163.com/star/。如果是location /blog/ ，就是代理访问到 http://ent.163.com/blog/。</p>
<p>后者，相当于告诉nginx，我这个location，是代理访问到http://ent.163.com/的，http://abc.163.com/star/ == http://ent.163.com/ ，可以这样理解。改变location，并不能改变返回的内容，返回的内容始终是http://ent.163.com/ 。 如果是location /blog/ ，那就是 http://abc.163.com/blog/ == http://ent.163.com/ 。</p>
<p>这样，也可以解释了上面那个location / 的例子，/ 嘛，加在server 的后面，仍然是 / ，所以，两种写法出来的结果是一样的。</p>
<p>PS: 如果是 location ~* ^/start/(.*)\.html 这种正则的location，是不能写&#8221;/&#8221;上去的，nginx -t 也会报错的了。因为，路径都需要正则匹配了嘛，并不是一个相对固定的locatin了，必然要代理到一个server。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/02/10/nginx-proxy_pass.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
