<?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>【知行合一】-Poople&#039;s Blog &#187; 技术博文</title>
	<atom:link href="http://99dev.net/archives/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://99dev.net</link>
	<description>智巧终归庸俗，雄谋只余虚话</description>
	<lastBuildDate>Fri, 23 Jul 2010 09:52:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[Original]Linux Server时间校对之优雅式</title>
		<link>http://99dev.net/archives/871</link>
		<comments>http://99dev.net/archives/871#comments</comments>
		<pubDate>Thu, 15 Jul 2010 08:36:58 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[MySQL数据库]]></category>
		<category><![CDATA[系统架构]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[databse]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ntp]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/871</guid>
		<description><![CDATA[在《解决Linux Server时间不准确的问题》一文中，使用了crontab定期执行ntpdate来校对时间。之后恰巧某博客上的文章，认为“时钟的跃变，有时候会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟，这是一项常见的假定，即，取得的时间是线性的，一些操作，例如数据库事务， 通常会地依赖这样的事实：时间不会往回跳跃。”时间的瞬变，对于crontab等对时间敏感的系统任务，也是很容易造成错乱的。
优雅的解决方案是，在机器刚开机时，执行ntpupdate直接修改系统时间，然后启动ntpd守护进程，渐进式逼近地调整系统时间，基本可以做到分毫不差。
误差小的时候，ntpd不会直接修改系统时间的，只是对时钟频率进行校正。这种方式好处是系统时间不会有跳变，不会影响像crontab这样程序的运行，缺点是校正需要一定的时间。
<span class="readmore"><a href="http://99dev.net/archives/871" title="[Original]Linux Server时间校对之优雅式" target="_blank">阅读全文——共589字</a></span>]]></description>
			<content:encoded><![CDATA[<p>在《解决Linux Server时间不准确的问题》一文中，使用了crontab定期执行ntpdate来校对时间。之后恰巧某博客上的文章，认为“时钟的跃变，有时候会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟，这是一项常见的假定，即，取得的时间是线性的，一些操作，<strong>例如数据库事务</strong>， 通常会地依赖这样的事实：时间不会往回跳跃。”时间的瞬变，对于crontab等对时间敏感的系统任务，也是很容易造成错乱的。</p>
<p><span style="color: #0000ff;">优雅的解决方案是，在机器刚开机时，执行ntpupdate直接修改系统时间，然后启动ntpd守护进程，渐进式逼近地调整系统时间，基本可以做到分毫不差。</span></p>
<p>误差小的时候，ntpd不会直接修改系统时间的，只是对时钟频率进行校正。这种方式好处是系统时间不会有跳变，不会影响像crontab这样程序的运行，缺点是校正需要一定的时间。</p>
<p>RHEL系统上，我们常用ntpd来完成该任务；而在Ubuntu系统里，我们则用openntpd来替代它。相对ntpd，openntpd是轻量级的网络时间协议，设置比较简单。关于ntpd和openntpd的设置，参考以下2篇文章</p>
<ol>
<li>NTP 時間伺服器     <a href="http://linux.vbird.org/linux_server/0440ntp.php">http://linux.vbird.org/linux_server/0440ntp.php</a></li>
<li>设定 OpenNTPD     <a href="http://wiki.debian.org.hk/w/Setup_OpenNTPD">http://wiki.debian.org.hk/w/Setup_OpenNTPD</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/871/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]解决linux server时间不准确的问题</title>
		<link>http://99dev.net/archives/870</link>
		<comments>http://99dev.net/archives/870#comments</comments>
		<pubDate>Tue, 13 Jul 2010 11:29:56 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[网络管理]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ntp]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/870</guid>
		<description><![CDATA[服务器每隔好几个月，总会差那么几分钟。应对措施，就是每隔段时间，进行网络对时。
以下摘自《鸟哥的私房菜》，可解读为什么会有偏差的问题。
事實上，在我們的身邊就有很多的原子鐘，例如石英表，還有電腦主機上面的 BIOS 內部就含有一個原子鐘在紀錄與計算時間的進行吶！不過由於原子鐘主要是利用計算晶片 (crystal) 的原子震盪週期去計時的，這是因為每種晶片都有自己的獨特的震盪週期之故。 然而因為這種晶片的震盪週期在不同的晶片之間多多少少都會有點差異性， 甚至同一批晶片也可能會或多或少有些許的差異(就連溫度也可能造成這樣的誤差呢！)，因此也就造成了 BIOS 的時間會三不五時的給他快了幾秒或者慢了幾秒。
<span class="readmore"><a href="http://99dev.net/archives/870" title="[Original]解决linux server时间不准确的问题" target="_blank">阅读全文——共1919字</a></span>]]></description>
			<content:encoded><![CDATA[<p>服务器每隔好几个月，总会差那么几分钟。应对措施，就是每隔段时间，进行网络对时。</p>
<p>以下摘自《鸟哥的私房菜》，可解读为什么会有偏差的问题。</p>
<blockquote><p>事實上，在我們的身邊就有很多的原子鐘，例如石英表，還有電腦主機上面的 BIOS 內部就含有一個原子鐘在紀錄與計算時間的進行吶！不過由於原子鐘主要是利用計算晶片 (crystal) 的原子震盪週期去計時的，這是因為每種晶片都有自己的獨特的震盪週期之故。 然而因為這種晶片的震盪週期在不同的晶片之間多多少少都會有點差異性， 甚至同一批晶片也可能會或多或少有些許的差異(就連溫度也可能造成這樣的誤差呢！)，因此也就造成了 BIOS 的時間會三不五時的給他快了幾秒或者慢了幾秒。</p>
<p>或許您會認為，BIOS 計時器每天快個五秒也沒有什麼了不起的，不過如果您再仔細的算一算，會發現，一天快五秒， 那麼一個月快2.5分鐘，一年就快了 75 分鐘了！所以說，呵呵！時間差是真的會存在的！ （依据该原理，只要关机或者重启次数越多，时间就会差得越离谱）</p>
</blockquote>
<p><b>1.挑选最快最稳定的ntp上层服务器</b></p>
<p> <span id="more-870"></span>
<p><b></b></p>
<blockquote><p>C:\Documents and Settings\linqp&gt;ping ntp.api.bz -n 100</p>
<p>Approximate round trip times in milli-seconds:</p>
<p>&#160;&#160;&#160; Minimum = 67ms, Maximum = 89ms, Average = 80ms</p>
<p><font color="#0000ff">C:\Documents and Settings\linqp&gt;ping t3.hshh.org -n 50</font></p>
<p><font color="#0000ff">Approximate round trip times in milli-seconds:</font></p>
<p><font color="#0000ff">&#160;&#160;&#160; Minimum = 18ms, Maximum = 22ms, Average = 19ms</font></p>
<p>C:\Documents and Settings\linqp&gt;ping t1.hshh.org -n 50</p>
<p>Approximate round trip times in milli-seconds:</p>
<p>&#160;&#160;&#160; Minimum = 22ms, Maximum = 27ms, Average = 24ms</p>
<p>C:\Documents and Settings\linqp&gt;ping 1.cn.pool.ntp.org -n 50</p>
<p>Ping statistics for 122.226.192.4:</p>
<p>&#160;&#160;&#160; Packets: Sent = 50, Received = 50, Lost = 0 (0% loss),</p>
<p>Approximate round trip times in milli-seconds:</p>
<p>&#160;&#160;&#160; Minimum = 18ms, Maximum = 24ms, Average = 21ms</p>
</blockquote>
<p><b>2.使用ntpdate同步系统时间</b></p>
<p>root@krc:~# /usr/sbin/ntpdate t3.hshh.org</p>
<ul>
<li>修改前</li>
</ul>
<blockquote><p>root@krc:~# date</p>
<p>Tue Jul 13 16:22:42 CST 2010</p>
<p>root@krc:~# hwclock -r</p>
<p>Tue 13 Jul 2010 04:21:23 PM CST -0.001126 seconds</p>
</blockquote>
<ul>
<li> 修改后</li>
</ul>
<blockquote><p>root@krc:~# date</p>
<p>Tue Jul 13 16:26:33 CST 2010</p>
<p>root@krc:~# hwclock -r</p>
<p>Tue 13 Jul 2010 04:26:45 PM CST -0.001124 seconds</p>
</blockquote>
<p><b>3.建立计划任务</b></p>
<p><b>root@krc:~#crontab -e </b></p>
<blockquote><p># m h dom mon dow command</p>
<p>00 00 * * * /bin/bash /usr/local/webserver/nginx/sbin/cut_nginx_log.sh</p>
<p>28 23 * * * /etc/webmin/cron/tempdelete.pl</p>
<p>1 0 * * 1 find /data1/backup_zone/data_www/* -mtime +28 |xargs rm -f</p>
<p>10 00 * * 1 cat /dev/null &gt; /data1/backup_zone/data_www/snapfile</p>
<p>11 00 * * * bash /root/script-bak/bak_www.sh</p>
<p>1 1 * * * bash /root/script-bak/bak_conf.sh</p>
<p>11 1 * * 1 find /data1/backup_zone/data_conf/* -mtime +28 |xargs rm -f</p>
<p><font color="#0000ff">*/10 * * * * /usr/sbin/ntpdate t3.hshh.org &amp;&amp; /sbin/hwclock -w</font></p>
</blockquote>
<p><b>4.参考资料</b></p>
<p>鸟哥的教程 <a href="http://linux.vbird.org/linux_server/0440ntp.php">http://linux.vbird.org/linux_server/0440ntp.php</a></p>
<p>Public NTP Server <a href="http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers">http://support.ntp.org/bin/view/Servers/StratumTwoTimeServers</a></p>
<p>Asia Public NTP Server <a href="http://www.pool.ntp.org/zone/cn">http://www.pool.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/870/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Vmware环境下，克隆Linux系统引发的网卡配置丢失问题</title>
		<link>http://99dev.net/archives/867</link>
		<comments>http://99dev.net/archives/867#comments</comments>
		<pubDate>Fri, 18 Jun 2010 07:48:59 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/867</guid>
		<description><![CDATA[系统环境 – Vmware WorkStation 7(同系列其他产品，如ESX/Esxi类似)
客户机操作系统 – Ubunt Linux Server 9.10

搭建测试环境，为了快速部署，使用Vmware的Clone功能，快速复制出许多客户机。
<span class="readmore"><a href="http://99dev.net/archives/867" title="[Collection]Vmware环境下，克隆Linux系统引发的网卡配置丢失问题" target="_blank">阅读全文——共707字</a></span>]]></description>
			<content:encoded><![CDATA[<blockquote><p>系统环境 – Vmware WorkStation 7(同系列其他产品，如ESX/Esxi类似)</p>
<p>客户机操作系统 – Ubunt Linux Server 9.10</p>
</blockquote>
<p>搭建测试环境，为了快速部署，使用Vmware的Clone功能，快速复制出许多客户机。</p>
<p>启动后发现个问题，除了源客户机，其他副本客户机，网络功能都不正常，具体表现为</p>
<ol>
<li>ifconfig输出的网络配置，只有lo，没有eth0 </li>
<li>“ifconfig –a”输出的网络配置中,eth0已经被自动修改为eth1了 </li>
<li>/etc/udev/rules.d/70-persistent-net.rules中，有eth0和eth1的详细定义。eth0为源客户机copy过来的；eth1为虚拟机自动生成的新网卡，定义区块的ATTR{address}记录着新网卡的mac(在虚拟机目录的VMX文件中，也能找到该mac地址) </li>
</ol>
<p> <span id="more-867"></span>
<ol><font size="5"><strong>故障分析</strong></font></ol>
<ol>为了避免同网段相同mac地址引发的广播风暴，Vmware自动添加了一块新网卡。Ubuntu识别并驱动了该网卡，却没有自动配置它，因此，出现上文那一幕。解决步骤Ubuntu Linux相关的网络配置</ol>
<ul>
<li>/etc/udev/rules.d/70-persistent-net.rules</li>
<li>/etc/network/interfaces</li>
</ul>
<p><font size="5"><strong>解决的思路有2个</strong></font></p>
<ul>
<li>删除/修改/etc/udev/rules.d/70-persistent-net.rules，事实证明，一般情况下，删除最方便，在networking服务重启的时候，会正确识别，并生成新的/etc/udev/rules.d/70-persistent-net.rules</li>
<li>修改interfaces，将其中的eth1统统替换为eth0<font color="#0000ff">(未验证)</font></li>
</ul>
<ol></ol>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/867/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Windows系统的本地提权</title>
		<link>http://99dev.net/archives/864</link>
		<comments>http://99dev.net/archives/864#comments</comments>
		<pubDate>Thu, 17 Jun 2010 06:50:33 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[网络管理]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/864</guid>
		<description><![CDATA[如同Linux的”sudo”
C:\Documents and Settings\linqp&#62;runas /h   RUNAS 用法: 
RUNAS [ [/noprofile &#124; /profile] [/env] [/netonly] ]   &#160;&#160;&#160;&#160;&#160;&#160;&#160; /user:&#60;UserName&#62; program 
RUNAS [ [/noprofile &#124; /profile] [/env] [/netonly] ]   &#160;&#160;&#160;&#160;&#160;&#160;&#160; /smartcard [/user:&#60;UserName&#62;] program 
<span class="readmore"><a href="http://99dev.net/archives/864" title="[Collection]Windows系统的本地提权" target="_blank">阅读全文——共977字</a></span>]]></description>
			<content:encoded><![CDATA[<p>如同Linux的”sudo”</p>
<p>C:\Documents and Settings\linqp&gt;runas /h   <br />RUNAS 用法: </p>
<p>RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; /user:&lt;UserName&gt; program </p>
<p>RUNAS [ [/noprofile | /profile] [/env] [/netonly] ]   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; /smartcard [/user:&lt;UserName&gt;] program </p>
<p> <span id="more-864"></span>
</p>
<p>&#160;&#160; /noprofile&#160;&#160;&#160;&#160;&#160;&#160;&#160; 指定不应该加载用户的配置文件。   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 这会加速应用程序加载，但    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 可能会造成一些应用程序运行不正常。    <br />&#160;&#160; /profile&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 指定应该加载用户的配置文件。    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 这是默认值。    <br />&#160;&#160; /env&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 要使用当前环境，而不是用户的环境。    <br />&#160;&#160; /netonly&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 只在指定的凭据限于远程访问的情况下才使用。 </p>
<p>&#160;&#160; /savecred&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 用用户以前保存的凭据。   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Windows XP Home Edition 上没有这个选项。    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 该选项会被忽略。    <br />&#160;&#160; /smartcard&#160;&#160;&#160;&#160;&#160;&#160;&#160; 如果凭据是智能卡提供的，则使用这个选项。 </p>
<p>&#160;&#160; /user&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;UserName&gt; 应使用 USER@DOMAIN 或 DOMAIN\USER 形式   <br />&#160;&#160; program&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; EXE. 的命令行。请参阅下面的例子 </p>
<p>例如:   <br />&gt; runas /noprofile /user:mymachine\administrator cmd    <br />&gt; runas /profile /env /user:mydomain\admin &quot;mmc %windir%\system32\dsa.ms    <br />&gt; runas /env /user:user@domain.microsoft.com &quot;notepad \&quot;my file.txt\&quot;&quot; </p>
<p>注意:&#160; 只在得到提示时才输入用户的密码。   <br />注意:&#160; USER@DOMAIN 跟 /netonly 不兼容。    <br />注意:&#160; /profile 跟 /netonly 不兼容。 </p>
<p>C:\Documents and Settings\linqp&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/864/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Adding Date And Time To Your Bash History</title>
		<link>http://99dev.net/archives/861</link>
		<comments>http://99dev.net/archives/861#comments</comments>
		<pubDate>Fri, 11 Jun 2010 03:45:00 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/861</guid>
		<description><![CDATA[多人管理同一台Linux Server，为了方便审计，最好在history内加入操作时间。
It comes in handy particularly if there are multiple people maintaining a given server (so you can see when a command was performed) or even if you are the sole maintainer, but can&#8217;t remember exactly when you did or changed something. 
Edit your /etc/bashrc and append to the bottom:
<span class="readmore"><a href="http://99dev.net/archives/861" title="[Collection]Adding Date And Time To Your Bash History" target="_blank">阅读全文——共746字</a></span>]]></description>
			<content:encoded><![CDATA[<p>多人管理同一台Linux Server，为了方便审计，最好在history内加入操作时间。</p>
<p>It comes in handy particularly if there are multiple people maintaining a given server (so you can see when a command was performed) or even if you are the sole maintainer, but can&#8217;t remember exactly when you did or changed something. </p>
<p>Edit your /etc/bashrc and append to the bottom:</p>
<blockquote><p>export HISTTIMEFORMAT=&quot;%h/%d &#8211; %H:%M:%S &quot;</p>
</blockquote>
<p> <span id="more-861"></span>
<p>From next login instead of: </p>
<p>574&#160; tail -f /var/log/maillog    <br />575&#160; mailq | tail -15     <br />576&#160; tail -f /var/log/maillog     <br />577&#160; less /var/log/maillog </p>
<p>you get: </p>
<p>1002&#160; Apr/30 &#8211; 11:46:16 grep duncan /var/log/maillog    <br />1003&#160; Apr/30 &#8211; 14:17:40 passwd jduncan     <br />1004&#160; Apr/30 &#8211; 14:18:02 smbpasswd jduncan     <br />1005&#160; Apr/30 &#8211; 14:50:28 history 10 </p>
<p>Hope this helps someone;)</p>
<ul>
<ul>
<li>To make it global and permanent to all users, edit /etc/profile and append to the bottom<font color="#0000ff">(已测试通过)</font> </li>
<li>It works also in my Ubuntu box. The file to modify is $HOME/.bashrc<font color="#0000ff">(已测试通过)</font> </li>
</ul>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/861/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]有进程僵死,长期驻留在后台,杀不了</title>
		<link>http://99dev.net/archives/859</link>
		<comments>http://99dev.net/archives/859#comments</comments>
		<pubDate>Thu, 10 Jun 2010 07:13:36 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[系统架构]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/859</guid>
		<description><![CDATA[故障现象
某Web服务器，突然出现以下问题，php-cgi僵死在进程里，无法重启
www 9463 0.0 0.3 41996 13612 ? D Apr19 1:22 /usr/local/php/bin/php-cgi &#8211;fpm      www 20858 0.0 0.3 40408 12932 ? D May05 1:55 /usr/local/php/bin/php-cgi &#8211;fpm       www 20866 0.0 0.3 40688 13296 ? D May05 1:53 /usr/local/php/bin/php-cgi &#8211;fpm       www 20878 0.0 0.3 40932 13604 ? D May05 1:51 /usr/local/php/bin/php-cgi &#8211;fpm       www 24288 0.0 0.3 40436 12880 ? D Apr15 2:36 /usr/local/php/bin/php-cgi &#8211;fpm       www 26881 0.0 0.3 41596 13712 ? D Apr16 6:11 /usr/local/php/bin/php-cgi &#8211;fpm       www 26921 0.0 0.3 43224 15848 ? D Apr16 5:57 /usr/local/php/bin/php-cgi &#8211;fpm       www 26983 0.0 0.3 42736 14524 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       www 27007 0.0 0.3 42608 14248 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       www 27023 0.0 0.3 42464 15172 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm
<span class="readmore"><a href="http://99dev.net/archives/859" title="[Original]有进程僵死,长期驻留在后台,杀不了" target="_blank">阅读全文——共938字</a></span>]]></description>
			<content:encoded><![CDATA[<p><font size="4"><strong>故障现象</strong></font></p>
<p>某Web服务器，突然出现以下问题，php-cgi僵死在进程里，无法重启</p>
<blockquote><p>www 9463 0.0 0.3 41996 13612 ? D Apr19 1:22 /usr/local/php/bin/php-cgi &#8211;fpm      <br />www 20858 0.0 0.3 40408 12932 ? D May05 1:55 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 20866 0.0 0.3 40688 13296 ? D May05 1:53 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 20878 0.0 0.3 40932 13604 ? D May05 1:51 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 24288 0.0 0.3 40436 12880 ? D Apr15 2:36 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26881 0.0 0.3 41596 13712 ? D Apr16 6:11 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26921 0.0 0.3 43224 15848 ? D Apr16 5:57 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 26983 0.0 0.3 42736 14524 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 27007 0.0 0.3 42608 14248 ? D Apr16 6:01 /usr/local/php/bin/php-cgi &#8211;fpm       <br />www 27023 0.0 0.3 42464 15172 ? D Apr16 5:57 /usr/local/php/bin/php-cgi –fpm</p>
</blockquote>
<p><font size="4"><strong>处理过程</strong></font></p>
<p> <span id="more-859"></span>
<p>1. “killall –9 php-cgi”无效</p>
<p>2. “pkill –9 php-cgi”无效</p>
<p>3. reboot操作系统，成功，D状态的php-cgi进程消失</p>
<p><font size="4"><strong>故障分析</strong></font></p>
<blockquote><p>D state 不是zombie进程，Z是zombie </p>
<p>D是uninterruptable sleep，看看dmesg里面是不是io driver出现问题了</p>
</blockquote>
<p><font size="4"><strong>~网上的几篇参考文章</strong></font></p>
<p>1. <a href="http://www.orczhou.com/index.php/2010/05/how-to-kill-an-uninterruptible-sleep-process/" target="_blank">How to kill an `uninterruptible sleep` process</a></p>
<p>2.<a href="http://blog.xupeng.me/2009/07/09/linux-uninterruptible-sleep-state/" target="_blank">Linux进程的Uninterruptible sleep(D)状态</a></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/859/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]主WEB服务器web service中断以及自动启动项不会up的问题</title>
		<link>http://99dev.net/archives/845</link>
		<comments>http://99dev.net/archives/845#comments</comments>
		<pubDate>Thu, 06 May 2010 01:53:04 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[其他Linux技术]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/845</guid>
		<description><![CDATA[# 查看默认的运行级别,Debian系默认运行级别为2,Redhat系默认运行级别为3
[11:34:29.9] root@webserver:/usr/local/webserver/nginx# runlevel
[11:34:31.8] N 2webserverwebserver

<span class="readmore"><a href="http://99dev.net/archives/845" title="[Original]主WEB服务器web service中断以及自动启动项不会up的问题" target="_blank">阅读全文——共2015字</a></span>]]></description>
			<content:encoded><![CDATA[<p># 查看默认的运行级别,Debian系默认运行级别为2,Redhat系默认运行级别为3</p>
<p>[11:34:29.9] root@webserver:/usr/local/webserver/nginx# runlevel</p>
<p>[11:34:31.8] N 2webserverwebserver</p>
<p><span id="more-845"></span>
<p>#运行开机启动项管理器,详细截图见sysv-rc-conf.png</p>
<p>[13:01:32.4] root@webserver:~# sysv-rc-conf</p>
<p>#可以看到存在一些不必要的启动服务,其中包含apache,该服务与nginx冲突</p>
<p>#确保rc.local服务在runlevel2被启用</p>
<p>#之前推测,nginx的https服务和kerio mailserver的https服务相冲突.结合了需求,该WebServer不会挂其他https站点.保留kerio mailserver,重新编译nginx,去掉https选项</p>
<p>[14:13:45.5] root@webserver:~/download/nginx-0.7.61# ./configure &#8211;user=www &#8211;group=www &#8211;prefix=/usr/local/webserver/nginx &#8211;with-http_stub_status_module</p>
<p>[14:14:04.9] root@webserver:~/download/nginx-0.7.61# make</p>
<p>#关闭有冲突的Apache Service</p>
<p>[13:07:10.1] root@webserver:~# /etc/init.d/apache2 stop</p>
<p>#关闭进程,重新安装nginx</p>
<p>[00:16:02.5] root@webserver:~# killall nginx</p>
<p>[00:16:12.6] root@webserver:~# cd /root/download</p>
<p>[00:16:28.7] root@webserver:~/download# cd nginx-0.7.61</p>
<p>[00:16:34.0] root@webserver:~/download/nginx-0.7.61# make install</p>
<p>[00:18:28.7] root@webserver:/usr/local/webserver/nginx/conf# nginx</p>
<p>#启动,测试rc.local是否成功执行</p>
<p>[00:26:00.2] root@webserver:/usr/local/webserver/nginx/conf# reboot</p>
<p>#查看nginx和php进程是否启动</p>
<p>[00:29:42.8] root@webserver:~# ps -aux|grep ngin</p>
<p>[00:29:55.9] www 6401 0.0 0.2 14764 11672 ? S 00:28 0:00 nginx: worker process</p>
<p>&nbsp;&nbsp;</p>
<p>[00:29:55.9] root@webserver:~# ps -aux|grep php</p>
<p>[00:29:59.9] root 6256 0.0 0.0 88624 3708 ? Ss 00:28 0:00 /usr/local/webserver/php/bin/php-cgi &#8211;fpm &#8211;fpm-config /usr/local/webserver/php/etc/php-fpm.conf</p>
<p>#陷阱1</p>
<p>The Mysterious &#8212; MARK &#8211;</p>
<p>All newbie admins asks what this means in /var/log/messages:</p>
<p>Jul 1 16:04:53 windbag &#8212; MARK &#8211;</p>
<p>Jul 1 16:24:53 windbag &#8212; MARK &#8211;</p>
<p>Jul 1 16:44:53 windbag &#8212; MARK &#8211;</p>
<p>That&#8217;s just the syslog daemon letting you know that it is alive and well. You may set the interval to anything you like on Debian by editing /etc/init.d/sysklogd. This sets it to 60 minutes:</p>
<p>SYSLOGD=&#8221;-m 60&#8243;</p>
<p>Then restart the syslog daemon:</p>
<p># /etc/init.d/sysklogd restart</p>
<p>On Red Hat and derivatives, edit /etc/sysconfig/syslog :</p>
<p>SYSLOGD_OPTIONS=&#8221;-m 60&#8243;</p>
<p>Restart syslogd with service syslog restart. Then watch it happen in realtime on any Linux with tail -f /var/log/messages. (You can monitor the changes in any text file with tail.)</p>
<p>#陷阱2</p>
<p>exiting due to signal 15</p>
<p>yslogd: exiting on signal 15 这个看上去是syslogd正常的退出信息</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/845/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Original]不能利用php的mail函数发送邮件的解决</title>
		<link>http://99dev.net/archives/844</link>
		<comments>http://99dev.net/archives/844#comments</comments>
		<pubDate>Thu, 29 Apr 2010 07:45:38 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/844</guid>
		<description><![CDATA[程序员反映在sun.xmnn.cn(192.168.96.55)不能利用PHP的mail()函数发送邮件。已解决。
设置步骤如下，

1.启动sendmail服务 /etc/init.d/sendmail start
<span class="readmore"><a href="http://99dev.net/archives/844" title="[Original]不能利用php的mail函数发送邮件的解决" target="_blank">阅读全文——共922字</a></span>]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;">程序员反映在sun.xmnn.cn(192.168.96.55)不能利用PHP的mail()函数发送邮件。已解决。</span></p>
<p><span style="font-size: medium;">设置步骤如下，</span></p>
<p><span id="more-844"></span>
<p><span style="font-size: medium;">1.启动sendmail服务 /etc/init.d/sendmail start</span></p>
<p><span style="font-size: medium;">2.将sendmail服务加入开机启动项 chkconfig sendmail on</span></p>
<p>3.编辑access文件,加入以下域</p>
<p>vim /etc/mail/access</p>
<p>Connect:xmnn.cn RELAY</p>
<p>4.编辑php-fpm.conf文件，去除sendmail_path键值的注释符号</p>
<p>vim /data/php/etc/php-fpm.conf</p>
<p>&lt;value name=&#8221;sendmail_path&#8221;&gt;/usr/sbin/sendmail -t -i&lt;/value&gt;</p>
<p>5.编辑php.ini文件，设置sendmai_path变量</p>
<p>vim /data/php/etc/php.ini</p>
<p>sendmail_path = /usr/sbin/sendmail -t -i</p>
<p>6.该台服务器有设置nameserver。如没有的话，请编辑/etc/resolv.conf</p>
<p>加入以下内容</p>
<p>nameserver 202.101.103.55</p>
<p>nameserver 202.101.103.54</p>
<p>7.另，利用命令行测试系统sendmail是否可用，请参考<a href="http://linux.vbird.org/linux_server/0380sendmail.php">此文章</a>中“Linux 下使用 telnet 功能”小节。</p>
<p>附部分测试程序</p>
<p>&lt;?php</p>
<p>&nbsp;&nbsp; if ($_SERVER['REQUEST_METHOD']==&#8217;POST&#8217;){</p>
<p>&nbsp;&nbsp; $email=$_POST['email'];</p>
<p>&nbsp;&nbsp; $to=&#8221;hery78567650@163.com&#8221;;</p>
<p>&nbsp;&nbsp; $subject = &#8220;Test Mail Send by XMNN.Apps&#8221;;</p>
<p>&nbsp;&nbsp; $message = &#8220;Hello! This is a test sent by php.apps on sunbbs. Poople&#8221;.$email;</p>
<p>&nbsp;&nbsp; $from = &#8220;sun@xmnn.cn&#8221;;</p>
<p>&nbsp;&nbsp; $headers = &#8220;From: $from&#8221;.&#8221;\r\n&#8221; .</p>
<p>&nbsp;&nbsp; &#8220;CC: 7215030@qq.com&#8221;;</p>
<p>&nbsp;&nbsp; if (mail($to,$subject,$message,$headers)){</p>
<p>&nbsp;&nbsp; echo &#8220;????&#8221;;</p>
<p>&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp; ?&gt;</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/844/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Collection]Linux服务器绑定ARP,防止ARP欺骗</title>
		<link>http://99dev.net/archives/843</link>
		<comments>http://99dev.net/archives/843#comments</comments>
		<pubDate>Fri, 23 Apr 2010 12:52:04 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[网络管理]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/843</guid>
		<description><![CDATA[编辑/etc/ethers,要这样格式写,还必须有可执行权限
IP空格MAC　(MAC间用：分开)
如下：

<span class="readmore"><a href="http://99dev.net/archives/843" title="[Collection]Linux服务器绑定ARP,防止ARP欺骗" target="_blank">阅读全文——共305字</a></span>]]></description>
			<content:encoded><![CDATA[<p>编辑/etc/ethers,要这样格式写,还必须有可执行权限</p>
<p>IP空格MAC　(MAC间用：分开)</p>
<p>如下：</p>
<blockquote>
<p>192.168.0.11 04:4B:80:80:80:01</p>
<p>192.168.0.12 04:4B:80:80:80:02</p>
<p>192.168.0.13 04:4B:80:80:80:03</p>
<p>192.168.0.14 04:4B:80:80:80:04</p>
</blockquote>
<p>最后在rc.local里加上下面一行</p>
<blockquote>
<p>arp -f /etc/ethers</p>
</blockquote>
<p>就OK了，开机自动加载</p>
<p><i>注:ethers文件里不能本机IP绑定本机MAC（不能自己梆自己），否则出错<br /></i></p>
<p>arp -s 用于在命令行下暂时绑定IP和MAC</p>
<p>arp -s 192.168.0.1 04:4B:80:80:80:04</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/843/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Colletcion]上亿个小文件如何备份或拷贝？</title>
		<link>http://99dev.net/archives/842</link>
		<comments>http://99dev.net/archives/842#comments</comments>
		<pubDate>Wed, 21 Apr 2010 03:05:16 +0000</pubDate>
		<dc:creator>蒼</dc:creator>
				<category><![CDATA[系统架构]]></category>
		<category><![CDATA[网络管理]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://99dev.net/archives/842</guid>
		<description><![CDATA[CCF的讨论,有参考价值,转过来研究一下
服务器上有上亿的25k~40k小文件约4T左右（每天还在不停增加），但磁盘马上要满了
磁盘结构NTFS
用treesize 列目录用了一个晚上，大概8小时
<span class="readmore"><a href="http://99dev.net/archives/842" title="[Colletcion]上亿个小文件如何备份或拷贝？" target="_blank">阅读全文——共468字</a></span>]]></description>
			<content:encoded><![CDATA[<p><b>CCF的讨论,有参考价值,转过来研究一下</b></p>
<p>服务器上有上亿的25k~40k小文件约4T左右（每天还在不停增加），但磁盘马上要满了</p>
<p>磁盘结构NTFS</p>
<p>用treesize 列目录用了一个晚上，大概8小时</p>
<p>用killcopy拷贝到NAS，在收集信息时就崩溃了</p>
<p>现在还没有好的方法处理这些文件</p>
<p>打开磁盘并不慢，因为这些文件被分在不同的目录下，目录也很多</p>
<p><span id="more-842"></span>
<p>A1:</p>
<p>RAR 估计够呛，我感觉 RAR 是先收集文件列表然后开始压缩的，而且还会故意把不同路径文件名相同的放在一起压。我们算一下，假如每个文件路径和相关信息存放在内存里平均需要 512 字节空间，那么收集 10 亿个文件列表就需要 476.8GB 内存，就算更乐观的情况——256 字节一个 file path entry，1 亿文件的列表也需要 23.84GB 内存空间。</p>
<p>这显然不具备实际意义。所以要是真想备份出去就只能用 ghost 之类的磁盘镜像工具了。ghost 出来以后要是想恢复部分文件，可以使用官方的 ghost Explorer。</p>
<p>A2:</p>
<p>这么多小文件，只能用block的方式去操作</p>
<p>以上的思路应该是正解,继续关注此帖,等待更好的解决思路.</p>
]]></content:encoded>
			<wfw:commentRss>http://99dev.net/archives/842/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
