<?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>江淼的Blog &#187; 系统管理</title>
	<atom:link href="http://www.jiangmiao.org/blog/c/%e7%b3%bb%e7%bb%9f%e7%ae%a1%e7%90%86/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jiangmiao.org/blog</link>
	<description>简单生活</description>
	<lastBuildDate>Sat, 24 Dec 2011 07:02:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Debian下配置mrtg</title>
		<link>http://www.jiangmiao.org/blog/938.html</link>
		<comments>http://www.jiangmiao.org/blog/938.html#comments</comments>
		<pubDate>Fri, 04 Jun 2010 04:34:11 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[ubuntu/debian]]></category>
		<category><![CDATA[系统管理]]></category>
		<category><![CDATA[mrtg]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=938</guid>
		<description><![CDATA[目标：配置mrtg并每5分钟更新一次mrtg到/var/www/mrtg 一、安装snmpd, mrtg apt-get install snmpd mrtg mrtg是基于snmp通信，snmpd必不可少 二、配置snmpd 修改 /etc/snmp/snmpd.conf com2sec paranoid default public #com2sec readonly default public #com2sec readwrite default private 为 # sec.name source community #com2sec paranoid default public com2sec readonly 127.0.0.1 public #com2sec readwrite default private &#8230; <a href="http://www.jiangmiao.org/blog/938.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>目标：配置mrtg并每5分钟更新一次mrtg到/var/www/mrtg<br />
<h3>一、安装snmpd, mrtg</h3>
<div class="pre">
<pre>
apt-get install snmpd mrtg
</pre>
</div>
<p>mrtg是基于snmp通信，snmpd必不可少<br />
<h3>二、配置snmpd</h3>
<p>修改 /etc/snmp/snmpd.conf
<div class="pre">
<pre>
com2sec paranoid   default         public
#com2sec readonly  default         public
#com2sec readwrite default         private
</pre>
</div>
<p>为
<div class="pre">
<pre>
#       sec.name  source          community
#com2sec paranoid  default         public
com2sec readonly  127.0.0.1         public
#com2sec readwrite default         private
</pre>
</div>
<p>创建一个source为本机，名为public的只读通信</p>
<p>重启snmpd<br />/etc/init.d/snmpd restart<br />
<h3>三、检测snmpd是否工作并显示当前网络的interface</h3>
<div class="pre">
<pre>
snmpwalk -v 1 -c public localhost 1.3.6.1.2.1.2.2.1.2
</pre>
</div>
<p>后面一串1.3.6.1.2.1.2.2.1.2为snmp通信的oid，意为ifDescr</p>
<p>如我的interface描述输出
<div class="pre">
<pre>
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.3 = STRING: venet0
</pre>
</div>
<p>有2个可监控的interface，1为localhost，3为virtual net<br />
<h3>四、编写mrtg.cfg</h3>
<p>虽说可以mrtg.cfg由cfgmaker生成，但手写mrtg.cfg可以更好的理解mrtg<br />理论上mrtg.cfg可以在任何位置，这里为/etc/mrtg.cfg，因为debian在/etc/cron.d/mrtg已为mrtg添加了周期为5分钟的cron
<div class="pre">
<pre>
#工作目录，也就是mrtg生成的图表等在的目录
WorkDir: /var/www/mrtg

#通用配置
#Title前缀
Title[^]: Traffic Analysis for
#以bit为单位，图表内的数据居右显示
Options[_]: bits, growright

#标题
Title[wan]: wan
#最大字节，比如10Mbps，那么MaxBytes为 10/8=1.25M=1250000
MaxBytes[wan]: 1250000
#监控目标 interface 3
Target[wan]: 3:public@127.0.0.1
</pre>
</div>
<h3>五、更新mrtg数据</h3>
<p>env LANG=C mrtg /etc/mrtg.cfg<br />生成的网页在/var/www/mrtg。通过对http访问该目录即可。<br />
<h3>六、添加至crontab</h3>
<p>若/etc/cron.d 中无mrtg那么可通过crontab -e添加一个cron
<div class="pre">
<pre>
*/5 *	*  *  env LANG=C /usr/bin/mrtg /etc/mrtg.cfg  2&gt;&amp;1 | tee -a /var/log/mrtg/mrtg.log
</pre>
</div>
<h3>七、相关链接</h3>
<p><a href="http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html" target="_blank">mrtg配置文档</a><br /><a href="http://www.alvestrand.no/objectid/top.html" target="_blank">snmp oid描述</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/938.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>linux命令行下的ctrl+r</title>
		<link>http://www.jiangmiao.org/blog/852.html</link>
		<comments>http://www.jiangmiao.org/blog/852.html#comments</comments>
		<pubDate>Fri, 16 Apr 2010 09:50:30 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[ubuntu/debian]]></category>
		<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=852</guid>
		<description><![CDATA[linux命令行的history是一个熟知但不常用的命令，原因是要查某个命令的编号需要输入 history&#124;grep xxx ，又因为!?xxx,!xxx 属于运行即执行也不方便，ctrl+r则方便多了。 ctrl+r用途：反向搜索执行过的命令。(reverse-i-search) 若对于现有history 611 ruby foo.rb 612 ruby bar.rb 613 ruby fo.rb 614 ruby ba.rb 615 &#8230; &#8230; 700 &#8230; 在不知道序号的情况下，若要运行ruby foo.rb。1、ctrl+r2、foo或1、ctrl+r2、fo3、ctrl+r (继续反向搜索)只需要寥寥几键。当然若仅是上几个命令还是[上]键更有效率。]]></description>
			<content:encoded><![CDATA[<p>linux命令行的history是一个熟知但不常用的命令，原因是要查某个命令的编号需要输入 history|grep xxx ，又因为!?xxx,!xxx 属于运行即执行也不方便，ctrl+r则方便多了。</p>
<p>ctrl+r<br />用途：反向搜索执行过的命令。(reverse-i-search)</p>
<p>若对于现有history<br />  611  ruby foo.rb<br />  612  ruby bar.rb<br />  613  ruby fo.rb<br />  614  ruby ba.rb<br />  615  &#8230;<br />  &#8230;<br />  700  &#8230;</p>
<p>在不知道序号的情况下，若要运行ruby foo.rb。<br />1、ctrl+r<br />2、foo<br />或<br />1、ctrl+r<br />2、fo<br />3、ctrl+r (继续反向搜索)<br />只需要寥寥几键。当然若仅是上几个命令还是[上]键更有效率。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/852.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>使用256色的debian终端</title>
		<link>http://www.jiangmiao.org/blog/408.html</link>
		<comments>http://www.jiangmiao.org/blog/408.html#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:51:23 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=408</guid>
		<description><![CDATA[　　putty ssh连debian，都只有8色，看到putty有xterm 256色选项，告诉我debian因该有可以支持256的方法。 #tput colors8  1、安装ncurse-termapt-get install ncurses-term 2、更改环境TERMexport TERM=xterm-256color # tput colors256 修改putty window-&#62;colours-&#62;Allow terminal to use 256-color mode. 成功！]]></description>
			<content:encoded><![CDATA[<p>　　putty ssh连debian，都只有8色，看到putty有xterm 256色选项，告诉我debian因该有可以支持256的方法。</p>
<p>#tput colors<br />8 </p>
<p>1、安装ncurse-term<br />apt-get install ncurses-term</p>
<p>2、更改环境TERM<br />export TERM=xterm-256color</p>
<p># tput colors<br />256</p>
<p>修改putty window-&gt;colours-&gt;Allow terminal to use 256-color mode.<br /> 成功！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/408.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>有惊无险,linux ext3文件夹误删恢复</title>
		<link>http://www.jiangmiao.org/blog/372.html</link>
		<comments>http://www.jiangmiao.org/blog/372.html#comments</comments>
		<pubDate>Fri, 13 Feb 2009 11:02:32 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=372</guid>
		<description><![CDATA[就在1小时前，不小心删除了linux的一个文件夹，里面有5个php文件。网上google下。 Q: How can I recover (undelete) deleted files from my ext3 partition? Actually, you can&#8217;t! This is what one of the developers, Andreas Dilger, said about it:In order to ensure that ext3 can safely resume an unlink after a &#8230; <a href="http://www.jiangmiao.org/blog/372.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>就在1小时前，不小心删除了linux的一个文件夹，里面有5个php文件。网上google下。</p>
<p><strong>Q: How can I recover (undelete) deleted files from my ext3 partition?</strong></p>
<p>Actually, you can&#8217;t! This is what one of the developers, Andreas Dilger, said about it:<em>In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas<br />ext2 just marks these blocks as unused in the block bitmaps and marks the inode as &#8220;deleted&#8221; and leaves the block pointers alone.</em></p>
<p><em></em><em>Your only hope is to &#8220;grep&#8221; for parts of your files that have been deleted and hope for the best. (出自 <a href="http://batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html">http://batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html</a> )</em></p>
<p>开发人员都这么说了，一时找不到北。突然灵感一现，若我直接从硬盘中搜索再复制，文件不多只有5个，且都是文本文件，可能有用。我立刻从网上下了个winhex，winhex是我用到现在最好的hex文件编辑器，看了看那个硬盘文件debian.vdi，不大只有3.9G。</p>
<p>我想，这几个文件都是这两天新建的，那么逆向搜索应该更有效。于是回忆每个文件中的几个函数名function xxx( 逆向搜，发现了不少残本。也不管新旧，都复制过来。就这么不一会，5个文件都原原本本的找了回来。</p>
<p>真是有惊无险。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/372.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>经测试VirtualBox比VMware慢20%</title>
		<link>http://www.jiangmiao.org/blog/346.html</link>
		<comments>http://www.jiangmiao.org/blog/346.html#comments</comments>
		<pubDate>Wed, 28 Jan 2009 21:27:52 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=346</guid>
		<description><![CDATA[一模一样的Debian环境与配置Rails production hello world controller测试结果为VMware: 169 reqs /sVirtualBox: 140 reqs /sVirtualBox比VMware慢20%VirtualBox开启VT-x/AMD-V后，性能提升为 163 reqs /s，但不清楚会不会对稳定性有影响，先不开用一段时间，确认非常稳定后再尝试开启吧。但VirtualBox比我的VMware冒似稳定很多，至少没有VMware的时间不稳定问题。测试用，这速度足够了，稳定大于一切嘛。 &#8212;2009-02-10 补充&#8212;VirtualBox非常稳定 ，到目前为止没出现过一次问题。但尝试开启VT-x/AMD-V系统进不去，不过现在的状态足矣。]]></description>
			<content:encoded><![CDATA[<p>一模一样的Debian环境与配置Rails production hello world controller测试结果为<br />VMware: 169 reqs /s<br />VirtualBox: 140 reqs /s<br />VirtualBox比VMware慢20%<br />VirtualBox开启VT-x/AMD-V后，性能提升为 163 reqs /s，但不清楚会不会对稳定性有影响，先不开用一段时间，确认非常稳定后再尝试开启吧。<br />但VirtualBox比我的VMware冒似稳定很多，至少没有VMware的时间不稳定问题。<br />测试用，这速度足够了，稳定大于一切嘛。</p>
<p>&#8212;2009-02-10 补充&#8212;<br />VirtualBox非常稳定 ，到目前为止没出现过一次问题。<br />但尝试开启VT-x/AMD-V系统进不去，不过现在的状态足矣。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/346.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>开始用VirtualBox了</title>
		<link>http://www.jiangmiao.org/blog/340.html</link>
		<comments>http://www.jiangmiao.org/blog/340.html#comments</comments>
		<pubDate>Wed, 28 Jan 2009 16:25:59 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=340</guid>
		<description><![CDATA[最近VMWARE变得不稳定，莫名的失去响应，拌随的症状是时钟走得飞快。不得其解，于是打算试试其它的虚拟机。 在wikipedia上面对琳琅满目的虚拟机，最后计划的替代产品为Virtual PC与Virtual Box，一个是Microsoft出的，一个是Sun出的，都是小母牛到北极的公司（牛X到极点） 先试了Virtual PC，不清楚咋搞的，连debian的mini.iso的安装画面都进不去。于是又下了Virtual Box，Sun果然牛，Virtual Box设计也很人性化，功能看似也很强大。现在正在通过网络安装debian，没有任何问题。希望在未来的使用过程中也能让用户满意，让群众放心。]]></description>
			<content:encoded><![CDATA[<p>最近VMWARE变得不稳定，莫名的失去响应，拌随的症状是时钟走得飞快。不得其解，于是打算试试其它的虚拟机。</p>
<p>在wikipedia上面对<a href="http://en.wikipedia.org/wiki/Comparison_of_platform_virtual_machines" target="_blank">琳琅满目的虚拟机</a>，最后计划的替代产品为Virtual PC与Virtual Box，一个是Microsoft出的，一个是Sun出的，都是小母牛到北极的公司（牛X到极点）</p>
<p>先试了Virtual PC，不清楚咋搞的，连debian的mini.iso的安装画面都进不去。于是又下了Virtual Box，Sun果然牛，Virtual Box设计也很人性化，功能看似也很强大。现在正在通过网络安装debian，没有任何问题。希望在未来的使用过程中也能让用户满意，让群众放心。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/340.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>web服务器由apache2转向nginx</title>
		<link>http://www.jiangmiao.org/blog/172.html</link>
		<comments>http://www.jiangmiao.org/blog/172.html#comments</comments>
		<pubDate>Wed, 24 Dec 2008 12:05:06 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=172</guid>
		<description><![CDATA[打算抛弃一起走过数年的apache2，选择更快的服务器，在lighttpd和nginx中犹豫了满久，两者速度不分伯仲，最终还是选择了单词比较短的nginx，- -很离谱的选择方式。 nginx静态文件比apache2快很多，但fastcgi比不上apache2内置模块快。因为多了个反向代理过程，现在可能看不出优势，但日后一定会感觉到，因为很容易实现负载均衡。 :)]]></description>
			<content:encoded><![CDATA[<p>打算抛弃一起走过数年的apache2，选择更快的服务器，在lighttpd和nginx中犹豫了满久，两者速度不分伯仲，最终还是选择了单词比较短的nginx，- -很离谱的选择方式。</p>
<p>nginx静态文件比apache2快很多，但fastcgi比不上apache2内置模块快。因为多了个反向代理过程，现在可能看不出优势，但日后一定会感觉到，因为很容易实现负载均衡。 :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/172.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Rsync备份数据</title>
		<link>http://www.jiangmiao.org/blog/76.html</link>
		<comments>http://www.jiangmiao.org/blog/76.html#comments</comments>
		<pubDate>Sun, 14 Dec 2008 13:48:51 +0000</pubDate>
		<dc:creator>JiangMiao</dc:creator>
				<category><![CDATA[系统管理]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[备份]]></category>

		<guid isPermaLink="false">http://www.jiangmiao.org/blog/?p=76</guid>
		<description><![CDATA[　　经历了硬盘数据全没了的痛苦，痛定思痛，作好每日或更短时间的备份功作犹为重要，真正做到有备无患。 &#8221;&#8217;准备：&#8221;&#8217; 系统环境：Debian 4.0 （其它linux大同小异） 需要权限：root &#8221;&#8217;安装：&#8221;&#8217; apt-get install rsync &#8221;&#8217;配置服务端：&#8221;&#8217; &#8221;&#8217;建立配置文件：/etc/rsyncd.conf&#8221;&#8217;Debian4下rsyncd.conf不直接提供，那就新建一个 vi /etc/rsyncd.conf 输入 uid = nobody gid = nogroup use chroot = no max connections = 4 pid file = /var/run/rsync.pid lock file = /var/run/rsync.lock log file=/var/log/rsync.log #备份的模块名 &#8230; <a href="http://www.jiangmiao.org/blog/76.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="noindent"><!--EasyFormat--><br />　　经历了硬盘数据全没了的痛苦，痛定思痛，作好每日或更短时间的备份功作犹为重要，真正做到有备无患。
<ol>
<li>&#8221;&#8217;准备：&#8221;&#8217;
<ul>
<li>系统环境：Debian 4.0 （其它linux大同小异）</li>
<li>需要权限：root</li>
</ul>
</li>
<li>&#8221;&#8217;安装：&#8221;&#8217;
<pre class="shell">apt-get install rsync</pre>
</li>
<li>&#8221;&#8217;配置服务端：&#8221;&#8217;
<ul>
<li>&#8221;&#8217;建立配置文件：/etc/rsyncd.conf&#8221;&#8217;<br />Debian4下rsyncd.conf不直接提供，那就新建一个
<pre class="shell">vi /etc/rsyncd.conf</pre>
<p>输入
<pre>
uid = nobody
gid = nogroup
use chroot = no
max connections = 4
pid file = /var/run/rsync.pid
lock file = /var/run/rsync.lock
log file=/var/log/rsync.log

#备份的模块名
[website]
path = /var/www
comment = backup
ignore errors
read only = true
list = false
#备份用户名
auth users = test
#帐号密码文件
secrets file = /etc/rsyncd.secrets</pre>
</li>
<li>&#8221;&#8217;建立帐号文件/etc/rsyncd.secrets&#8221;&#8217;
<pre class="shell">vi /etc/rsyncd.secrets</pre>
<p>输入
<pre>
#用户名:密码
test:test</pre>
</li>
<li>&#8221;&#8217;更改rsyncd.secrets的权限为只读&#8221;&#8217;
<pre class="shell">chmod 0400 /etc/rsyncd.secrets</pre>
</li>
<li>&#8221;&#8217;配置inetd&#8221;&#8217;
<pre class="shell">vi /etc/inetd.conf</pre>
<p>添加
<pre>rsync stream tcp nowait root /usr/bin/rsync rsync --daemon</pre>
</li>
<li>&#8221;&#8217;重启inetd&#8221;&#8217;
<pre class="shell">/etc/init.d/openbsd-inetd restart</pre>
</li>
</ul>
</li>
<li>&#8221;&#8217;配置客户端&#8221;&#8217;
<ul>
<li>&#8221;&#8217;建立密码文件password&#8221;&#8217;
<pre class="shell">echo 'test'>password</pre>
</li>
<li>&#8221;&#8217;同步数据&#8221;&#8217;
<pre class="shell">rsync -vzrtopg --progress --password-file=password test@服务器IP::website /var/www</pre>
<p>同步服务器IP的website到目录/var/www<br />-v &#8211;verbose #输出调试信息<br />-z &#8211;compress #压缩数据<br />-r &#8211;recursive #递归目录，通俗讲就是包括所有子目录<br />-t &#8211;times #保持时间<br />-o &#8211;owner #保持所有者<br />-p &#8211;permission #保持permission<br />-g &#8211;group #保持组		</li>
</ul>
</ul>
</li>
</ol>
<p><!--End of EasyFormat--></div>
]]></content:encoded>
			<wfw:commentRss>http://www.jiangmiao.org/blog/76.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

