<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/korea_vps/</link>
<title><![CDATA[如愿以偿将博客的VPS迁到韩国]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Tue, 26 Aug 2014 17:49:25 +0000</pubDate> 
<guid>http://zyan.cc/korea_vps/</guid> 
<description>
<![CDATA[ 
	　　这几天，原博客所在的美国洛杉矶digitalocean的VPS不稳定，决定再次搬迁。现在已经将博客（<a href="http://zyan.cc" target="_blank">http://zyan.cc</a>）迁移到韩国的VPS。国内到韩国的网络线路，应该是最好的，甚至可以媲美中国国内的双线机房。<br/><br/>　　北京联通 ping zyan.cc：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">root@linaro-alip:~# ping zyan.cc<br/>PING zyan.cc (27.255.71.186) 56(84) bytes of data.<br/>64 bytes from 27.255.71.186: icmp_req=1 ttl=50 time=68.3 ms<br/>64 bytes from 27.255.71.186: icmp_req=2 ttl=50 time=63.0 ms<br/>64 bytes from 27.255.71.186: icmp_req=3 ttl=50 time=67.4 ms<br/>64 bytes from 27.255.71.186: icmp_req=4 ttl=50 time=69.5 ms<br/>64 bytes from 27.255.71.186: icmp_req=5 ttl=50 time=62.9 ms<br/>64 bytes from 27.255.71.186: icmp_req=6 ttl=50 time=69.9 ms<br/>64 bytes from 27.255.71.186: icmp_req=7 ttl=50 time=63.2 ms</div><br/><br/>　　广东电信 ping zyan.cc：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@local ~]# ping zyan.cc<br/>PING zyan.cc (27.255.71.186) 56(84) bytes of data.<br/>64 bytes from 27.255.71.186: icmp_seq=1 ttl=46 time=93.6 ms<br/>64 bytes from 27.255.71.186: icmp_seq=2 ttl=46 time=93.2 ms<br/>64 bytes from 27.255.71.186: icmp_seq=3 ttl=46 time=92.8 ms<br/>64 bytes from 27.255.71.186: icmp_seq=4 ttl=46 time=93.0 ms<br/>64 bytes from 27.255.71.186: icmp_seq=5 ttl=46 time=93.0 ms<br/>64 bytes from 27.255.71.186: icmp_seq=6 ttl=46 time=92.7 ms</div><br/><br/>　　杭州阿里云 ping zyan.cc：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@AY140521163455018f38Z ~]# ping zyan.cc<br/>PING zyan.cc (27.255.71.186) 56(84) bytes of data.<br/>64 bytes from 27.255.71.186: icmp_seq=1 ttl=48 time=30.8 ms<br/>64 bytes from 27.255.71.186: icmp_seq=2 ttl=48 time=30.5 ms<br/>64 bytes from 27.255.71.186: icmp_seq=3 ttl=48 time=30.4 ms<br/>64 bytes from 27.255.71.186: icmp_seq=4 ttl=48 time=30.7 ms<br/>64 bytes from 27.255.71.186: icmp_seq=5 ttl=48 time=30.6 ms<br/>64 bytes from 27.255.71.186: icmp_seq=6 ttl=48 time=30.3 ms<br/>64 bytes from 27.255.71.186: icmp_seq=7 ttl=48 time=31.2 ms</div><br/>Tags - <a href="http://zyan.cc/tags/%25E9%259F%25A9%25E5%259B%25BDvps/" rel="tag">韩国vps</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/samba_linux_windows/</link>
<title><![CDATA[快速配置 Samba 将 Linux 目录映射为 Windows 驱动器，用于跨平台编程]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Fri, 08 Apr 2011 00:53:45 +0000</pubDate> 
<guid>http://zyan.cc/samba_linux_windows/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2011.04.08 转载请注明原文链接：<a href="http://blog.zyan.cc/samba_linux_windows/" target="_blank">http://blog.zyan.cc/samba_linux_windows/</a>]<br/><br/>　　<strong>一、局域网内的 Linux 服务器上操作步骤：</strong><br/><br/>　　1、安装samba（CentOS Linux）：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">yum install samba system-config-samba samba-client samba-common</div><br/><br/>　　2、创建www账号<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/usr/sbin/groupadd www<br/>/usr/sbin/useradd -g www www<br/><br/>mkdir -p /data0/knose/<br/>chmod 777 /data0/knose/<br/><br/>mkdir -p /data0/htdocs/<br/>chown -R www:www /data0/htdocs/<br/>chmod 777 /data0/htdocs/<br/><br/>cat /etc/passwd &#124; mksmbpasswd.sh> /etc/samba/smbpasswd</div><br/><br/>　　3、创建samba配置文件<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">mv -f /etc/samba/smb.conf /etc/samba/smb.conf.bak<br/>vi /etc/samba/smb.conf</div><br/>　　输入以下内容：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">[global]<br/>server string = Samba Server<br/>security = user<br/>encrypt passwords = yes <br/>smb passwd file = /etc/samba/smbpasswd<br/><br/>[knose]<br/>workgroup = root<br/>netbios name = root<br/>path = /data0/knose<br/>browseable = yes<br/>writeable = yes<br/><br/>[web]<br/>workgroup = www<br/>netbios name = www<br/>path = /data0/htdocs<br/>browseable = yes<br/>writeable = yes</div></div><br/><br/>　　4、为samba用户www、root设立一个密码：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">smbpasswd -a www<br/>smbpasswd -a root</div><br/><br/>　　5、启动samba：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/sbin/service smb start</div><br/><br/><hr/><br/>　　<strong>二、局域网内的 Windows 服务器上操作步骤：</strong><br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/samba/" rel="tag">samba</a> , <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/windows/" rel="tag">windows</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/sersync/</link>
<title><![CDATA[金山逍遥网 sersync 服务器实时镜像、自动同步程序开源]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Wed, 14 Apr 2010 11:32:30 +0000</pubDate> 
<guid>http://zyan.cc/sersync/</guid> 
<description>
<![CDATA[ 
	　　Sersync 是我们金山逍遥网技术支持部平台组<a href="http://code.google.com/u/zhouyangkunta/" target="_blank">周洋</a>同学，开发的一款基于 inotify + rsync 的大量文件的多服务器自动同步程序，目前已开源，开源协议为 New BSD License。<br/><br/>　　<strong>原理：</strong><br/>　　使用 Linux 2.6 内核的 inotify 监控 Linux 文件系统事件，被监听目录下如果有文件发生修改，sersync 将通过内核自动捕获到事件，并将该文件利用 rsync 同步到多台远程服务器。sersync 仅仅同步发生增、删、改事件的单个文件或目录，不像rsync镜像同步那样需要比对双方服务器整个目录下数千万的文件，并且支持多线程同步，因此效率非常高。<br/><br/>　　<strong>应用：</strong><br/>　　金山游戏官网的 CMS 内容发布系统。无论编辑通过 Web 还是 FTP 上传图片、视频、附件，还是系统工程师直接去CMS发布服务器上增加、修改、删除文件，干完这些事情后不用做任何处理，sersync 会自动将发生增、删、改事件的文件同步到远程服务器，并可以在文件同步完成后，自动调用 CDN（ChinaCache）缓存刷新接口，刷新发生修改、删除的文件的访问 URL。<br/><br/>　　更多内容，请访问项目网址：<a href="http://code.google.com/p/sersync/" target="_blank">http://code.google.com/p/sersync/</a><br/><br/><br/>Tags - <a href="http://zyan.cc/tags/sersync/" rel="tag">sersync</a> , <a href="http://zyan.cc/tags/inotify/" rel="tag">inotify</a> , <a href="http://zyan.cc/tags/rsync/" rel="tag">rsync</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/android_server/</link>
<title><![CDATA[Google Android 手机上的服务器系统运维工具[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Wed, 10 Feb 2010 09:13:50 +0000</pubDate> 
<guid>http://zyan.cc/android_server/</guid> 
<description>
<![CDATA[ 
	　　今天是节前最后一天上班。今年春节回老婆的老家过年，没有电脑和网络，如果服务器有什么问题，就希望借助 Google Android 手机上的一些小工具来处理了。<br/><br/>　　我的G1手机装了<a href="http://www.hiapk.com/bbs/forum-135-1.html" target="_blank">HiAPK 的 Android 1.6 Rom</a>，自带了PPTP/L2TP/IPSec VPN的支持，可以先通过它拨入服务器的VPN内网。<br/><br/>　　<a href="http://zyan.cc/attachment/201002/g02.png" target="_blank"><img src="http://zyan.cc/attachment/201002/g02.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a> <a href="http://zyan.cc/attachment/201002/g03.png" target="_blank"><img src="http://zyan.cc/attachment/201002/g03.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><hr/><br/>　　<strong>SSH工具：connectbot</strong><br/>　　下载地址：<a href="http://code.google.com/p/connectbot/" target="_blank">http://code.google.com/p/connectbot/</a><br/><br/>　　用它可以登录Linux/Unix服务器，进行相关操作。<br/><br/>　　<a href="http://zyan.cc/attachment/201002/g04.png" target="_blank"><img src="http://zyan.cc/attachment/201002/g04.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/android/" rel="tag">android</a> , <a href="http://zyan.cc/tags/server/" rel="tag">server</a> , <a href="http://zyan.cc/tags/%25E7%25B3%25BB%25E7%25BB%259F%25E8%25BF%2590%25E7%25BB%25B4/" rel="tag">系统运维</a> , <a href="http://zyan.cc/tags/%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8/" rel="tag">服务器</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/startssl/</link>
<title><![CDATA[全球可信并且唯一免费的HTTPS(SSL)证书颁发机构：StartSSL]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Fri, 13 Nov 2009 16:21:05 +0000</pubDate> 
<guid>http://zyan.cc/startssl/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2009.11.14 转载请注明原文链接：<a href="http://blog.zyan.cc/startssl/" target="_blank">http://blog.zyan.cc/startssl/</a>]<br/><br/>　　HTTPS（全称：Hypertext Transfer Protocol over Secure Socket Layer），是以安全为目标的HTTP通道，简单讲是HTTP的安全版。即HTTP下加入SSL层，HTTPS的安全基础是SSL，因此加密的详细内容请看SSL。<br/><br/>　　它是一个URI scheme（抽象标识符体系），句法类同http:体系。用于安全的HTTP数据传输。https:URL表明它使用了HTTP，但HTTPS存在不同于HTTP的默认端口及一个加密/身份验证层（在HTTP与TCP之间）。这个系统的最初研发由网景公司进行，提供了身份验证与加密通讯方法，现在它被广泛用于万维网上安全敏感的通讯，例如交易支付方面。<br/><br/><hr/><br/>　　<strong>1、自行颁发不受浏览器信任的SSL证书：</strong><br/>　　HTTPS的SSL证书可以自行颁发，Linux下的颁发步骤如下：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">openssl genrsa -des3 -out api.bz.key 1024<br/>openssl req -new -key api.bz.key -out api.bz.csr<br/>openssl rsa -in api.bz.key -out api.bz_nopass.key</div><br/>　　<a href="http://zyan.cc/attachment.php?fid=59" target="_blank"><img src="http://zyan.cc/attachment.php?fid=59" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>　　Nginx.conf的SSL证书配置，使用api.bz_nopass.key，在启动Nginx是无需输入SSL证书密码，而使用api.bz.key则需要输入密码：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> server<br/> &#123;<br/>&nbsp;&nbsp; server_name sms.api.bz;<br/>&nbsp;&nbsp; listen&nbsp;&nbsp;443;<br/>&nbsp;&nbsp; index index.html index.htm index.php;<br/><br/>&nbsp;&nbsp; root&nbsp;&nbsp;/data0/htdocs/api.bz;<br/><br/>&nbsp;&nbsp; ssl on;<br/>&nbsp;&nbsp; ssl_certificate api.bz.crt;<br/>&nbsp;&nbsp; ssl_certificate_key api.bz_nopass.key;<br/>&nbsp;&nbsp; ......<br/> &#125;</div></div><br/><br/>　　自行颁发的SSL证书虽然能够实现加密传输功能，但得不到浏览器的信任，会出现以下提示：<br/>　　<a href="http://zyan.cc/attachment.php?fid=60" target="_blank"><img src="http://zyan.cc/attachment.php?fid=60" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><hr/><br/>　　<strong>2、受浏览器信任的StartSSL免费SSL证书：</strong><br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/startssl/" rel="tag">startssl</a> , <a href="http://zyan.cc/tags/startcom/" rel="tag">startcom</a> , <a href="http://zyan.cc/tags/https/" rel="tag">https</a> , <a href="http://zyan.cc/tags/ssl/" rel="tag">ssl</a> , <a href="http://zyan.cc/tags/openssl/" rel="tag">openssl</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/dips/</link>
<title><![CDATA[利用开源的Gearman框架构建分布式图片处理平台[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Sun, 01 Nov 2009 01:24:10 +0000</pubDate> 
<guid>http://zyan.cc/dips/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2009.11.01 转载请注明原文链接：<a href="http://blog.zyan.cc/dips/" target="_blank">http://blog.zyan.cc/dips/</a>]<br/><br/>　　2009年10月28日，在金山逍遥技术支持部内部分享会上，介绍了Gearman分布式计算框架与金山逍遥DIPS分布式图片处理平台，以下是PPT图片：<br/><br/>　　<a href="http://blog.zyan.cc/attachment/200910/dips/jpg/dips1.jpg" target="_blank"><img src="http://blog.zyan.cc/attachment/200910/dips/jpg/dips1.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>　　<a href="http://blog.zyan.cc/attachment/200910/dips/jpg/dips2.jpg" target="_blank"><img src="http://blog.zyan.cc/attachment/200910/dips/jpg/dips2.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/dips/" rel="tag">dips</a> , <a href="http://zyan.cc/tags/%25E5%2588%2586%25E5%25B8%2583%25E5%25BC%258F%25E8%25AE%25A1%25E7%25AE%2597/" rel="tag">分布式计算</a> , <a href="http://zyan.cc/tags/%25E5%2588%2586%25E5%25B8%2583%25E5%25BC%258F%25E5%259B%25BE%25E7%2589%2587%25E5%25A4%2584%25E7%2590%2586/" rel="tag">分布式图片处理</a> , <a href="http://zyan.cc/tags/gearman/" rel="tag">gearman</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/pptp_vpn/</link>
<title><![CDATA[CentOS 5.3 下快速安装配置 PPTP VPN 服务器]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Tue, 13 Oct 2009 15:56:43 +0000</pubDate> 
<guid>http://zyan.cc/pptp_vpn/</guid> 
<description>
<![CDATA[ 
	　　VPN的英文全称是“Virtual Private Network”，翻译过来就是“虚拟专用网络”。顾名思义，虚拟专用网络我们可以把它理解成是虚拟出来的企业内部专线。它可以通过特殊的加密的通讯协议在连接在Internet上的位于不同地方的两个或多个企业内部网之间建立一条专有的通讯线路，就好比是架设了一条专线一样，但是它并不需要真正的去铺设光缆之类的物理线路。这就好比去电信局申请专线，但是不用给铺设线路的费用，也不用购买路由器等硬件设备。VPN技术原是路由器具有的重要技术之一，目前在交换机，防火墙设备或Windows等软件里也都支持VPN功能，一句话，VPN的核心就是在利用公共网络建立虚拟私有网。<br/><br/>　　虚拟专用网（VPN）被定义为通过一个公用网络（通常是因特网）建立一个临时的、安全的连接，是一条穿过混乱的公用网络的安全、稳定的隧道。虚拟专用网是对企业内部网的扩展。虚拟专用网可以帮助远程用户、公司分支机构、商业伙伴及供应商同公司的内部网建立可信的安全连接，并保证数据的安全传输。虚拟专用网可用于不断增长的移动用户的全球因特网接入，以实现安全连接；可用于实现企业网站之间安全通信的虚拟专用线路，用于经济有效地连接到商业伙伴和用户的安全外联网虚拟专用网。<br/><br/>　　PPTP 全称为 Point to Point Tunneling Protocol -- 点到点隧道协议，是VPN协议中的一种。<br/><br/>　　<strong>一、CentOS 5.3 下 PPTP VPN 服务器安装</strong><br/><br/>　　<strong>1、安装相关软件</strong><br/>　　32位版：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">yum install -y ppp iptables<br/>wget <a href="http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.i386.rpm" target="_blank">http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.i386.rpm</a><br/>rpm -ivh pptpd-1.3.4-2.rhel5.i386.rpm</div><br/>　　64位版：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">yum install -y ppp iptables<br/>wget <a href="http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm" target="_blank">http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm</a><br/>rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm</div><br/><br/>　　<strong>2、配置文件编写</strong><br/>　　<strong>①、配置文件/etc/ppp/options.pptpd</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">mv /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak<br/>vi /etc/ppp/options.pptpd</div><br/>　　输入以下内容：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">name pptpd<br/>refuse-pap<br/>refuse-chap<br/>refuse-mschap<br/>require-mschap-v2<br/>require-mppe-128<br/>proxyarp<br/>lock<br/>nobsdcomp<br/>novj<br/>novjccomp<br/>nologfd<br/>idle 2592000<br/>ms-dns 8.8.8.8<br/>ms-dns 8.8.4.4</div><br/><hr/><br/>　　<strong>②、配置文件/etc/ppp/chap-secrets</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">mv /etc/ppp/chap-secrets /etc/ppp/chap-secrets.bak<br/>vi /etc/ppp/chap-secrets</div><br/>　　输入以下内容<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;"># Secrets for authentication using CHAP<br/># client&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;server&nbsp;&nbsp;secret&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IP addresses<br/>myusername pptpd mypassword *</div><br/>　　注：这里的myusername和mypassword即为PPTP VPN的登录用户名和密码<br/><br/><hr/><br/>　　<strong>③、配置文件/etc/pptpd.conf</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">mv /etc/pptpd.conf /etc/pptpd.conf.bak<br/>vi /etc/pptpd.conf</div><br/>　　输入以下内容：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">option /etc/ppp/options.pptpd<br/>logwtmp<br/>localip 192.168.9.1<br/>remoteip 192.168.9.11-30</div><br/>　　注：为拨入VPN的用户动态分配192.168.9.11～192.168.9.30之间的IP<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/pptp/" rel="tag">pptp</a> , <a href="http://zyan.cc/tags/vpn/" rel="tag">vpn</a> , <a href="http://zyan.cc/tags/ppp/" rel="tag">ppp</a> , <a href="http://zyan.cc/tags/centos/" rel="tag">centos</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/419/</link>
<title><![CDATA[Linux C/C++ 内存泄漏检测工具：Valgrind]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Fri, 31 Jul 2009 13:01:30 +0000</pubDate> 
<guid>http://zyan.cc/post/419/</guid> 
<description>
<![CDATA[ 
	　　Valgrind 是一款 Linux下（支持 x86、x86_64和ppc32）程序的内存调试工具，它可以对编译后的二进制程序进行内存使用监测（C语言中的malloc和free，以及C++中的new和delete），找出内存泄漏问题。<br/><br/>　　Valgrind 中包含的 Memcheck 工具可以检查以下的程序错误：<br/><br/>　　使用未初始化的内存 (Use of uninitialised memory)<br/>　　使用已经释放了的内存 (Reading/writing memory after it has been free’d)<br/>　　使用超过malloc分配的内存空间(Reading/writing off the end of malloc’d blocks)<br/>　　对堆栈的非法访问 (Reading/writing inappropriate areas on the stack)<br/>　　申请的空间是否有释放 (Memory leaks – where pointers to malloc’d blocks are lost forever)<br/>　　malloc/free/new/delete申请和释放内存的匹配(Mismatched use of malloc/new/new [] vs free/delete/delete [])<br/>　　src和dst的重叠(Overlapping src and dst pointers in memcpy() and related functions)<br/>　　重复free<br/><br/>　　1、编译安装 Valgrind：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">wget <a href="http://valgrind.org/downloads/valgrind-3.4.1.tar.bz2" target="_blank">http://valgrind.org/downloads/valgrind-3.4.1.tar.bz2</a><br/>tar xvf valgrind-3.4.1.tar.bz2<br/>cd valgrind-3.4.1/<br/>./configure --prefix=/usr/local/webserver/valgrind<br/>make<br/>make install</div><br/><br/>　　2、使用示例：对“ls”程序进程检查，返回结果中的“definitely lost: 0 bytes in 0 blocks.”表示没有内存泄漏。<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@xoyo42 /]# <font color="green">/usr/local/webserver/valgrind/bin/valgrind --tool=memcheck --leak-check=full ls /</font><br/>==1157== Memcheck, a memory error detector.<br/>==1157== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.<br/>==1157== Using LibVEX rev 1884, a library for dynamic binary translation.<br/>==1157== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.<br/>==1157== Using valgrind-3.4.1, a dynamic binary instrumentation framework.<br/>==1157== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.<br/>==1157== For more details, rerun with: -v<br/>==1157== <br/>bin&nbsp;&nbsp; data0&nbsp;&nbsp;dev&nbsp;&nbsp;home&nbsp;&nbsp;lib64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; media&nbsp;&nbsp;mnt&nbsp;&nbsp;opt&nbsp;&nbsp; root&nbsp;&nbsp;selinux&nbsp;&nbsp;sys&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tcsql.db.idx.pkey.dec&nbsp;&nbsp;ttserver.pid&nbsp;&nbsp;var<br/>boot&nbsp;&nbsp;data1&nbsp;&nbsp;etc&nbsp;&nbsp;lib&nbsp;&nbsp; lost+found&nbsp;&nbsp;misc&nbsp;&nbsp; net&nbsp;&nbsp;proc&nbsp;&nbsp;sbin&nbsp;&nbsp;srv&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tcsql.db&nbsp;&nbsp;tmp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;usr<br/>==1157== <br/>==1157== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 5 from 1)<br/>==1157== malloc/free: in use at exit: 28,471 bytes in 36 blocks.<br/>==1157== malloc/free: 166 allocs, 130 frees, 51,377 bytes allocated.<br/>==1157== For counts of detected errors, rerun with: -v<br/>==1157== searching for pointers to 36 not-freed blocks.<br/>==1157== checked 174,640 bytes.<br/>==1157== <br/>==1157== LEAK SUMMARY:<br/>==1157==&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">definitely lost: 0 bytes in 0 blocks.</font><br/>==1157==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;possibly lost: 0 bytes in 0 blocks.<br/>==1157==&nbsp;&nbsp;&nbsp;&nbsp;still reachable: 28,471 bytes in 36 blocks.<br/>==1157==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suppressed: 0 bytes in 0 blocks.<br/>==1157== Reachable blocks (those to which a pointer was found) are not shown.<br/>==1157== To see them, rerun with: --leak-check=full --show-reachable=yes</div><br/><br/>　　3、使用示例：对一个使用libevent库编写的“httptest”程序进程检查，返回结果中的“definitely lost: 255 bytes in 5 blocks.”表示发生内存泄漏。<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@xoyo42 tcsql-0.1]# <font color="green">/usr/local/webserver/valgrind/bin/valgrind --tool=memcheck --leak-check=full ./httptest</font><br/>==1274== Memcheck, a memory error detector.<br/>==1274== Copyright (C) 2002-2008, and GNU GPL'd, by Julian Seward et al.<br/>==1274== Using LibVEX rev 1884, a library for dynamic binary translation.<br/>==1274== Copyright (C) 2004-2008, and GNU GPL'd, by OpenWorks LLP.<br/>==1274== Using valgrind-3.4.1, a dynamic binary instrumentation framework.<br/>==1274== Copyright (C) 2000-2008, and GNU GPL'd, by Julian Seward et al.<br/>==1274== For more details, rerun with: -v<br/>==1274== <br/>==1274== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1005 from 2)<br/>==1274== malloc/free: in use at exit: 402,291 bytes in 74 blocks.<br/>==1274== malloc/free: 15,939 allocs, 15,865 frees, 6,281,523 bytes allocated.<br/>==1274== For counts of detected errors, rerun with: -v<br/>==1274== searching for pointers to 74 not-freed blocks.<br/>==1274== checked 682,468,160 bytes.<br/>==1274== <br/>==1274== 255 bytes in 5 blocks are definitely lost in loss record 17 of 32<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;at 0x4A05FBB: malloc (vg_replace_malloc.c:207)<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;by 0x3C1D809BC6: <font color="red">evhttp_decode_uri (http.c:2105)</font><br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;by 0x401C75: tcsql_handler (in /data0/tcsql/cankao/tcsql-0.1/tcsql)<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;by 0x3C1D80C88F: evhttp_get_body (http.c:1582)<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;by 0x3C1D8065F7: event_base_loop (event.c:392)<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;by 0x403E2F: main (in /data0/tcsql/cankao/tcsql-0.1/tcsql)<br/>==1274== <br/>==1274== LEAK SUMMARY:<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">definitely lost: 255 bytes in 5 blocks.</font><br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;possibly lost: 0 bytes in 0 blocks.<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;still reachable: 402,036 bytes in 69 blocks.<br/>==1274==&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suppressed: 0 bytes in 0 blocks.<br/>==1274== Reachable blocks (those to which a pointer was found) are not shown.<br/>==1274== To see them, rerun with: --leak-check=full --show-reachable=yes</div><br/><br/>　　检查httptest程序，发现有一处“char *decode_uri = evhttp_decode_uri(evhttp_request_uri(req));”中的“decode_uri”没有被free，再程序处理完成后加上“free(decode_uri);”后，再使用Valgrind检查，结果已经是“definitely lost: 0 bytes in 0 blocks.”。<br/><br/><br/>Tags - <a href="http://zyan.cc/tags/valgrind/" rel="tag">valgrind</a> , <a href="http://zyan.cc/tags/c/" rel="tag">c</a> , <a href="http://zyan.cc/tags/c%252B%252B/" rel="tag">c++</a> , <a href="http://zyan.cc/tags/c%252Fc%252B%252B/" rel="tag">c/c++</a> , <a href="http://zyan.cc/tags/%25E5%2586%2585%25E5%25AD%2598%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">内存调试</a> , <a href="http://zyan.cc/tags/%25E5%2586%2585%25E5%25AD%2598%25E6%25B3%2584%25E6%25BC%258F/" rel="tag">内存泄漏</a> , <a href="http://zyan.cc/tags/%25E5%2586%2585%25E5%25AD%2598%25E6%25B3%2584%25E6%25BC%258F%25E6%25A3%2580%25E6%25B5%258B/" rel="tag">内存泄漏检测</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/ntp_api_bz/</link>
<title><![CDATA[稳定的NTP时间同步服务器集群：ntp.api.bz[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Thu, 16 Jul 2009 14:54:05 +0000</pubDate> 
<guid>http://zyan.cc/ntp_api_bz/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2009.07.16 转载请注明原文链接：<a href="http://blog.zyan.cc/ntp_api_bz/" target="_blank">http://blog.zyan.cc/ntp_api_bz/</a>]<br/><br/> 　　NTP（Network Time Protocol）是由美国德拉瓦大学的David L. Mills教授于1985年提出，除了可以估算封包在网络上的往返延迟外，还可独立地估算计算机时钟偏差，从而实现在网络上的高精准度计算机校时，它是设计用来在Internet上使不同的机器能维持相同时间的一种通讯协定。时间服务器（time server）是利用NTP的一种服务器，通过它可以使网络中的机器维持时间同步。在大多数的地方，NTP可以提供1-50ms的可信赖性的同步时间源和网络工作路径。<br/><br/>　　网络时间协议（NTP）的详细说明在RFC-1305[Mills 1992]中。RFC-1305对 NTP协议自动机在事件、状态、转变功能和行为方面给出了明确的说明。它以合适的算法以增强时钟的准确性，并且减轻多个由于同步源而产生的差错，实现了准确性低于毫秒的时间服务，以满足目前因特网中路径量测的需要。<br/><br/>　　<span style="color: #FF0000;">ntp.api.bz</span> 是一组NTP服务器集群，目前有6台服务器，位于上海电信。这项服务是 api.bz 继 <a href="http://sms.api.bz" target="_blank">http://sms.api.bz</a> 移动飞信免费短信发送接口之后的第二项免费 API 服务。<br/><br/>　　<strong>客户端设置：</strong><br/><br/>　　1、Linux服务器可通过 ntpdate 命令与时间服务器同步（如果没有安装ntp软件，CentOS可以通过“yum install ntp”命令安装）：<br/><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/usr/sbin/ntpdate ntp.api.bz</div><br/><br/>　　如果想定时执行ntpdate进行时间同步，可以通过crontab来进行：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">crontab -e</div><br/>　　输入以下内容，每小时的第19分钟做一次时间同步：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">19 * * * * /usr/sbin/ntpdate ntp.api.bz</div><br/><br/><br/>　　2、Windows服务器或个人电脑请用鼠标双击屏幕右下角的时间，按照下图设置：<br/><br/>　　<a href="http://zyan.cc/attachment.php?fid=25" target="_blank"><img src="http://zyan.cc/attachment.php?fid=25" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>　　点击“立即更新”就可以马上更新时间，响应速度与成功率要比原有的 time.windows.com 高得多。<br/>Tags - <a href="http://zyan.cc/tags/ntp/" rel="tag">ntp</a> , <a href="http://zyan.cc/tags/ntpd/" rel="tag">ntpd</a> , <a href="http://zyan.cc/tags/ntpdate/" rel="tag">ntpdate</a> , <a href="http://zyan.cc/tags/%25E6%2597%25B6%25E9%2597%25B4%25E5%2590%258C%25E6%25AD%25A5/" rel="tag">时间同步</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/linux_ext3_undelete/</link>
<title><![CDATA[实例：Linux EXT3文件系统下成功恢复误删的文件[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Sun, 05 Jul 2009 16:46:29 +0000</pubDate> 
<guid>http://zyan.cc/linux_ext3_undelete/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2009.07.06 转载请注明原文链接：<a href="http://blog.zyan.cc/linux_ext3_undelete/" target="_blank">http://blog.zyan.cc/linux_ext3_undelete/</a>]<br/><br/>　　环境：CentOS 5.3 x86_64下，/dev/sdb1为数据分区/data0，EXT3文件系统。<br/>　　前因：误删了/data0/tcsql/cankao/phpcws-1.5.0/httpcws.cpp文件。由于忘了备份httpcws.cpp文件，重新开发工作量较大，因此只有恢复该文件一条路可走。<br/><br/>　　debugfs命令针对EXT2分区还行，但对EXT3分区就帮不上忙了。偶然发现的一款开源软件，解决了我的大忙。该软件下载网址为：<br/>　　<a href="http://code.google.com/p/ext3grep/" target="_blank">http://code.google.com/p/ext3grep/</a><br/><br/>　　1、先安装ext3grep软件：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">wget <a href="http://ext3grep.googlecode.com/files/ext3grep-0.10.1.tar.gz" target="_blank">http://ext3grep.googlecode.com/files/ext3grep-0.10.1.tar.gz</a><br/>tar zxvf ext3grep-0.10.1.tar.gz<br/>cd ext3grep-0.10.1<br/>./configure<br/>make<br/>make install</div><br/><br/>　　2、umount /data0分区：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">umount /data0</div><br/>　　如果提示busy，先kill正在使用这个目录的进程，再umount：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">fuser -k /data0<br/>umount /data0</div><br/><br/>　　3、查询所有Inode，（执行需要几分钟～十多分钟）：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">ext3grep /dev/sdb1 --ls --inode 2</div><br/>　　<a href="http://zyan.cc/attachment.php?fid=21" target="_blank"><img src="http://zyan.cc/attachment.php?fid=21" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>　　4、逐级查找Inode，看是否能找到httpcws.cpp文件（此步骤也可省略）：<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/ext3/" rel="tag">ext3</a> , <a href="http://zyan.cc/tags/ext3grep/" rel="tag">ext3grep</a> , <a href="http://zyan.cc/tags/%25E6%2581%25A2%25E5%25A4%258D%25E6%2596%2587%25E4%25BB%25B6/" rel="tag">恢复文件</a> , <a href="http://zyan.cc/tags/%25E8%25AF%25AF%25E5%2588%25A0%25E6%2596%2587%25E4%25BB%25B6/" rel="tag">误删文件</a> , <a href="http://zyan.cc/tags/%25E5%2588%25A0%25E9%2599%25A4%25E6%2596%2587%25E4%25BB%25B6/" rel="tag">删除文件</a> , <a href="http://zyan.cc/tags/undelete/" rel="tag">undelete</a> , <a href="http://zyan.cc/tags/debugfs/" rel="tag">debugfs</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/409/</link>
<title><![CDATA[基于开源Flash Server：Red5构建RTMP流媒体播放平台[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Mon, 13 Apr 2009 15:13:12 +0000</pubDate> 
<guid>http://zyan.cc/post/409/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2009.04.13 转载请注明原文链接：<a href="http://blog.zyan.cc/post/409/" target="_blank">http://blog.zyan.cc/post/409/</a>]<br/><br/>　　上周五，我们基于开源Flash Server：Red5（<a href="http://osflash.org/red5" target="_blank">http://osflash.org/red5</a>）的Flash流媒体服务平台上线，内容涉及视频上传、视频分发、调用接口、Flash播放器等。<br/><br/>　　<strong>一、Flash RTMP流媒体播放演示</strong>（播放时进度条可以自由拖动）：<br/><br/><div>　　<object id="xoyovideo" width="480" height="300" ><param name="allowScriptAccess" value="always" /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://api.v.xoyo.com/external/player.swf?config=http://api.v.xoyo.com/external/video-22.swf" type="application/x-shockwave-flash" name="xoyovideo" allowFullScreen="true" allowScriptAccess="always" width="480" height="300"></embed></object></div><br/>　　生产环境更多 Flash RTMP 流媒体视频演示：<a href="http://jx3.xoyo.com/xgxz/video/" target="_blank">http://jx3.xoyo.com/xgxz/video/</a><br/><br/><hr/><br/>　　<strong>二、安装步骤简要说明：</strong><br/>　　①、安装JDK<br/>　　打开<a href="http://java.sun.com/javase/downloads/" target="_blank">http://java.sun.com/javase/downloads/</a>，下载最新的Java SE Development Kit (JDK)，安装在/usr/local/jdk/下。<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">chmod +x jdk-6u13-linux-i586.bin<br/>./jdk-6u13-linux-i586.bin</div><br/><br/>　　②、安装Red5<br/>　　打开<a href="http://osflash.org/red5/070final" target="_blank">http://osflash.org/red5/070final</a>，下载red5-0.7.0.tar.gz，解压缩后执行./red5.sh，然后访问<a href="http://yourdomain:5080/" target="_blank">http://yourdomain:5080/</a>，有演示。<br/><br/><hr/><br/>　　<strong>三、服务器带宽消耗比较：</strong><br/>　　①、客户端 1.5M ADSL 环境，HTTP 方式播放单个视频，服务器所消耗的带宽：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@localhost ~]# ./net.sh eth0 1<br/>IN: 3318 Byte/s OUT: 259984 Byte/s<br/>IN: 3486 Byte/s OUT: 249470 Byte/s<br/>IN: 3332 Byte/s OUT: 259984 Byte/s<br/>IN: 3090 Byte/s OUT: 252528 Byte/s<br/>IN: 3000 Byte/s OUT: 252474 Byte/s<br/>IN: 3000 Byte/s OUT: 253976 Byte/s<br/>IN: 2940 Byte/s OUT: 255478 Byte/s<br/>IN: 3004 Byte/s OUT: 252474 Byte/s<br/>IN: 3452 Byte/s OUT: 252528 Byte/s<br/>IN: 3270 Byte/s OUT: 260038 Byte/s<br/>IN: 3586 Byte/s OUT: 252474 Byte/s</div><br/><br/>　　②、客户端 1.5M ADSL 环境，RTMP 流媒体方式播放单个视频，服务器所消耗的带宽：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@localhost ~]# ./net.sh eth0 1<br/>IN: 3900 Byte/s OUT: 27878 Byte/s<br/>IN: 4200 Byte/s OUT: 30868 Byte/s<br/>IN: 4380 Byte/s OUT: 27801 Byte/s<br/>IN: 4080 Byte/s OUT: 29965 Byte/s<br/>IN: 4080 Byte/s OUT: 26450 Byte/s<br/>IN: 3960 Byte/s OUT: 27143 Byte/s<br/>IN: 3000 Byte/s OUT: 10061 Byte/s<br/>IN: 3960 Byte/s OUT: 16166 Byte/s<br/>IN: 3660 Byte/s OUT: 26480 Byte/s<br/>IN: 4020 Byte/s OUT: 23127 Byte/s</div><br/><br/>　　HTTP 方式播放，如果服务器端不限速，客户端的带宽越大，服务器消耗的带宽也越大，但限速又会影响用户体验；<br/>　　RTMP 流媒体方式播放，只要客户端达到最低带宽要求，不管客户端的带宽如何，服务器消耗的带宽都一样。<br/><br/>　　如果播放10M以内大小的视频，HTTP 能够在较短的时间内下载完视频，能够降低并发观看用户数；<br/>　　如果播放10M以上大小的视频，RTMP 要比 HTTP 方式节省不少带宽。<br/><br/>　　RTMP 播放时进度条可以自由拖动，虽然Lighttpd和Nginx目前也可以使用somevideo.flv?start=xxx的方式从指定位置下载视频，但还是不如 RTMP 灵活。<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/red5/" rel="tag">red5</a> , <a href="http://zyan.cc/tags/rtmp/" rel="tag">rtmp</a> , <a href="http://zyan.cc/tags/flash/" rel="tag">flash</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/fetion_api/</link>
<title><![CDATA[中国移动飞信免费发短信API接口（第三方 Fetion API）[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Sun, 22 Mar 2009 02:35:39 +0000</pubDate> 
<guid>http://zyan.cc/fetion_api/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.1 最后修改：2010.08.03 转载请注明原文链接：<a href="http://blog.zyan.cc/fetion_api/" target="_blank">http://blog.zyan.cc/fetion_api/</a>]<br/><br/>　　<span style="color: #FF0000;">备注：2010年7月底移动飞信修改协议，造成影响的 sms.api.bz 免费发送短信API接口，已于2010年8月3日19:00恢复正常。</span><br/><br/>　　<a href="http://www.fetion.com.cn/" target="_blank">飞信</a>是由中国移动通信集团公司推出的一款集商务应用和娱乐功能为一体的，基于手机应用以及与Internet深度互通的即时通讯产品，可免费给好友发送短信。<br/><br/>　　1、下载中国移动飞信PC客户端软件（<a href="http://www.fetion.com.cn/downloads/pc.aspx" target="_blank">http://www.fetion.com.cn/downloads/pc.aspx</a>），并注册开通飞信。注册成为飞信用户，下载飞信PC客户端、使用PC客户端基本功能，不收取费用。<br/>　　2、通过PC客户端，邀请并添加免费短信接收方的手机号码（仅限中国移动）到您的飞信好友，该手机号需要通过通过PC客户端、或回复短信接受您的邀请；<br/>　　3、通过 <a href="http://sms.api.bz/" target="_blank">http://sms.api.bz/</a> 提供的 API 接口，即可免费给飞信好友或给你自己的手机发短信。利用本API接口可进行日程提醒、服务器监控、报警、故障通知或短信自动控制等功能。<br/><br/><hr/><br/>　　<span style="color: #FF0000;">飞信免费发短信API接口在线演示页面：</span><br/><br/>　　<a href="http://sms.api.bz/" target="_blank">http://sms.api.bz/</a><br/><br/>　　<a href="https://sms.api.bz/" target="_blank">https://sms.api.bz/</a> （HTTPS加密接口）<br/><br/><br/><br/>　　飞信免费发短信API接口调用方式（通过HTTP访问以下网址、支持GET和POST）：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;"><a href="http://sms.api.bz/fetion.php?username=" target="_blank">http://sms.api.bz/fetion.php?username=</a>您的移动飞信登录手机号&password=您的移动飞信登录密码&sendto=接收短信的飞信好友手机号（也可以是你自己的手机号）&message=短信内容</div><br/>　　注：短信内容最大长度为180个汉字，超过180个汉字不发送。返回的信息为UTF-8编码的中文文本信息。<br/><br/><br/><br/>　　<span style="color: #FF0000;">2009年5月28日新增：</span>飞信免费发短信API接口调用方式（通过HTTPS加密隧道访问以下网址、支持GET和POST，进一步保证您的密码安全）：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;"><a href="https://sms.api.bz/fetion.php?username=" target="_blank">https://sms.api.bz/fetion.php?username=</a>您的移动飞信登录手机号&password=您的移动飞信登录密码&sendto=接收短信的飞信好友手机号（也可以是你自己的手机号）&message=短信内容</div><br/>　　注：短信内容最大长度为180个汉字，超过180个汉字不发送。返回的信息为UTF-8编码的中文文本信息。<br/><br/>　　<a href="http://zyan.cc/attachment.php?fid=70" target="_blank"><img src="http://zyan.cc/attachment.php?fid=70" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><hr/><br/>　　例1：在Linux命令行下通过curl命令给自己的手机号（假设为13800138000）发送短信（HTTP GET 方式）<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">curl "http://sms.api.bz/fetion.php?username=13800138000&password=123456&sendto=13800138000&message=短信内容"</div><br/><br/>　　例2：在PHP5中通过file_get_contents函数发送短信（HTTP GET 方式）<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/%25E9%25A3%259E%25E4%25BF%25A1/" rel="tag">飞信</a> , <a href="http://zyan.cc/tags/fetion/" rel="tag">fetion</a> , <a href="http://zyan.cc/tags/api/" rel="tag">api</a> , <a href="http://zyan.cc/tags/%25E5%2585%258D%25E8%25B4%25B9%25E7%259F%25AD%25E4%25BF%25A1/" rel="tag">免费短信</a> , <a href="http://zyan.cc/tags/%25E5%2585%258D%25E8%25B4%25B9%25E5%258F%2591%25E7%259F%25AD%25E4%25BF%25A1/" rel="tag">免费发短信</a> , <a href="http://zyan.cc/tags/%25E5%2585%258D%25E8%25B4%25B9%25E5%258F%2591%25E9%2580%2581%25E7%259F%25AD%25E4%25BF%25A1/" rel="tag">免费发送短信</a> , <a href="http://zyan.cc/tags/%25E7%259F%25AD%25E4%25BF%25A1%25E7%25BD%2591%25E5%2585%25B3/" rel="tag">短信网关</a> , <a href="http://zyan.cc/tags/%25E5%2585%258D%25E8%25B4%25B9%25E6%2589%258B%25E6%259C%25BA%25E7%259F%25AD%25E4%25BF%25A1/" rel="tag">免费手机短信</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/399/</link>
<title><![CDATA[网易的开源软件镜像站点]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Mon, 23 Feb 2009 15:54:25 +0000</pubDate> 
<guid>http://zyan.cc/post/399/</guid> 
<description>
<![CDATA[ 
	　　网易开通了一个开源软件的镜像站点，网址为：<br/><br/>　　<a href="http://mirrors.163.com/" target="_blank">http://mirrors.163.com/</a><br/><br/>　　提供的镜像有：<br/><br/>　　1、Linux及BSD发行版镜像：FreeBSD、OpenBSD、RedHat、archlinux、centos、debian、fedora、gentoo、trixbox、ubuntu等。<br/><br/>　　2、开源软件镜像：eclipse可扩展开发平台、防火墙、openfiler网络存储管理工具。<br/><br/>　　该镜像目前只有一台杭州电信的服务器，网通用户访问可能会比较慢。<br/><br/><hr/><br/>　　如果您安装 CentOS 5.2 系统的服务器位于电信机房，您可以修改/etc/yum.repos.d/CentOS-Base.repo文件，将它的yum源更改成网易的镜像，代替国外的镜像，以便获取更快的下载速度。<br/><br/>　　您可以按照以下步骤从 <a href="http://blog.zyan.cc" target="_blank">blog.zyan.cc</a> 下载修改后的 CentOS-Base.repo 文件到您的服务器。<br/><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">cd /etc/yum.repos.d/<br/>mv CentOS-Base.repo CentOS-Base.repo.bak<br/>wget <a href="http://blog.zyan.cc/soft/linux/centos/5.2/CentOS-Base.repo" target="_blank">http://blog.zyan.cc/soft/linux/centos/5.2/CentOS-Base.repo</a></div><br/><hr/><br/>　　附：修改后的 CentOS-Base.repo 文件内容如下：<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/mirror/" rel="tag">mirror</a> , <a href="http://zyan.cc/tags/%25E9%2595%259C%25E5%2583%258F/" rel="tag">镜像</a> , <a href="http://zyan.cc/tags/%25E7%25BD%2591%25E6%2598%2593/" rel="tag">网易</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/387/</link>
<title><![CDATA[一款不错的Linux命令行下的FTP客户端软件]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Fri, 12 Dec 2008 10:57:46 +0000</pubDate> 
<guid>http://zyan.cc/post/387/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2008.12.12 转载请注明原文链接：<a href="http://blog.zyan.cc/post/387/" target="_blank">http://blog.zyan.cc/post/387/</a>]<br/><br/>　　借用了兄弟部门在全国N台服务器的空间放一些视频文件，由于只给我开放FTP帐号，于是找了一款Linux命令行下的FTP客户端软件──ncftp，用来作整个目录批量上传。ncftpput是它的一个附带程序，在shell脚本中调用ncftpput上传文件到FTP服务器，非常方便。<br/><br/>　　详细内容见其官方网站：<a href="http://www.ncftp.com/" target="_blank">http://www.ncftp.com/</a><br/><br/>　　编译安装：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">wget <a href="ftp://ftp.ncftp.com/ncftp/ncftp-3.2.2-src.tar.gz" target="_blank">ftp://ftp.ncftp.com/ncftp/ncftp-3.2.2-src.tar.gz</a><br/>tar zxvf ncftp-3.2.2-src.tar.gz<br/>cd ncftp-3.2.2/<br/>./configure --prefix=/usr/local/ncftp<br/>make && make install</div><br/><br/>　　示例：将本地/data0/htdocs/videofile/flv/games/目录内的所有文件和目录，上传到FTP服务器的flv/games/目录内（如果不存在flv/games/目录则自动创建）。<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/usr/local/ncftp/bin/ncftpput -u FTP帐号 -p FTP密码 -P FTP端口 -m -R 192.168.1.2&nbsp;&nbsp;flv/games/ /data0/htdocs/videofile/flv/games/*</div><br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/ftp/" rel="tag">ftp</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/380/</link>
<title><![CDATA[Linux下简单限制网卡的带宽[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[其他Unix技术]]></category>
<pubDate>Thu, 20 Nov 2008 08:56:48 +0000</pubDate> 
<guid>http://zyan.cc/post/380/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.0 最后修改：2008.11.20 转载请注明原文链接：<a href="http://blog.zyan.cc/post/380/" target="_blank">http://blog.zyan.cc/post/380/</a>]<br/><br/>　　Linux下限制网卡的带宽，可用来模拟服务器带宽耗尽，从而测试服务器在此时的访问效果。<br/><br/>　　1、安装iproute<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">yum -y install iproute</div><br/><br/>　　2、限制eth0网卡的带宽为50kbit：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/sbin/tc qdisc add dev eth0 root tbf rate 50kbit latency 50ms burst 1000</div><br/><br/>　　3、限制带宽为50kbit后，在百兆局域网中wget下载一个大文件：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@localhost ~]# wget <a href="http://192.168.1.7/test.zip" target="_blank">http://192.168.1.7/test.zip</a> <br/>--19:40:27--&nbsp;&nbsp;<a href="http://192.168.1.7/test.zip" target="_blank">http://192.168.1.7/test.zip</a><br/>Connecting to 192.168.1.7:80... connected.<br/>HTTP request sent, awaiting response... 200 OK<br/>Length: 23862312 (23M) [application/zip]<br/>Saving to: `test.zip'<br/><br/>37% [=======>&nbsp;&nbsp; ] 8,994,816&nbsp;&nbsp;&nbsp;&nbsp;457K/s&nbsp;&nbsp;eta 27s</div><br/>　　下载速度为457K/s，限制效果达到。<br/><br/>　　4、解除eth0网卡的带宽限制：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/sbin/tc qdisc del dev eth0 root tbf</div><br/><br/>　　5、对比：未作带宽限制情况下，在百兆局域网中wget下载一个大文件：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">[root@localhost ~]# wget <a href="http://192.168.1.7/test.zip&nbsp;&nbsp;&nbsp;&nbsp;" target="_blank">http://192.168.1.7/test.zip&nbsp;&nbsp;&nbsp;&nbsp;</a><br/>--19:44:33--&nbsp;&nbsp;<a href="http://192.168.1.7/test.zip" target="_blank">http://192.168.1.7/test.zip</a><br/>Connecting to 192.168.1.7:80... connected.<br/>HTTP request sent, awaiting response... 200 OK<br/>Length: 23862312 (23M) [application/zip]<br/>Saving to: `test.zip'<br/><br/>100%[==========>] 23,862,312&nbsp;&nbsp;6.14M/s&nbsp;&nbsp; in 3.7s&nbsp;&nbsp; <br/><br/>19:44:36 (6.16 MB/s) - `test.zip' saved [23862312/23862312]</div><br/>　　下载速度为6.16MB/s。<br/><br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/tc/" rel="tag">tc</a> , <a href="http://zyan.cc/tags/%25E5%25B8%25A6%25E5%25AE%25BD/" rel="tag">带宽</a>
]]>
</description>
</item>
</channel>
</rss>