<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>wolfg&#039;s Weblog &#187; SysAdmin</title>
	<atom:link href="http://guoyong.me/category/linux/sysadm/feed/" rel="self" type="application/rss+xml" />
	<link>http://guoyong.me</link>
	<description>wolfg&#039;s journey with open source, linux, programming, sysadm ...</description>
	<lastBuildDate>Wed, 04 Apr 2012 12:42:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.5/cn/</creativeCommons:license>		<item>
		<title>MongoDB日志回滚</title>
		<link>http://guoyong.me/linux/sysadm/mongodb%e6%97%a5%e5%bf%97%e5%9b%9e%e6%bb%9a/</link>
		<comments>http://guoyong.me/linux/sysadm/mongodb%e6%97%a5%e5%bf%97%e5%9b%9e%e6%bb%9a/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 00:51:02 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=641</guid>
		<description><![CDATA[# kill -SIGUSR1 `cat /var/run/mongodb.pid` 用在shell脚本里时，命令要改成这样： kill -USR1 `cat /var/run/mongodb.pid` 参考：http://www.mongodb.org/display/DOCS/Logging#Logging-Rotatingthelogfiles]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># kill -SIGUSR1 `cat /var/run/mongodb.pid`</div></div>
<p>用在shell脚本里时，命令要改成这样： kill -USR1 `cat /var/run/mongodb.pid` </p>
<p>参考：http://www.mongodb.org/display/DOCS/Logging#Logging-Rotatingthelogfiles   </p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/mongodb%e6%97%a5%e5%bf%97%e5%9b%9e%e6%bb%9a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RHEL5下编译MongoDB</title>
		<link>http://guoyong.me/linux/sysadm/rhel5%e4%b8%8b%e7%bc%96%e8%af%91mongodb/</link>
		<comments>http://guoyong.me/linux/sysadm/rhel5%e4%b8%8b%e7%bc%96%e8%af%91mongodb/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 06:21:29 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mongodb]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=630</guid>
		<description><![CDATA[很多人都说自己编译的稳定好用，我也来试试： 1. 参考官方文档，手工编译Spider Monkey # curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz # tar zxvf js-1.7.0.tar.gz # cd js/src # export CFLAGS=&#34;-DJS_C_STRINGS_ARE_UTF8&#34; # make -f Makefile.ref # JS_DIST=/usr make -f Makefile.ref export 2. 安装scons，用官网的rpm包就行。 3. 重新编译pcre。自带的编译时没带&#8211;enable-unicode-properties参数，mongdb启动时会提示：warning: some regex utf8 things will not work. pcre &#8230; <a href="http://guoyong.me/linux/sysadm/rhel5%e4%b8%8b%e7%bc%96%e8%af%91mongodb/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>很多人都说自己编译的稳定好用，我也来试试：</p>
<p>1. 参考官方文档，手工编译Spider Monkey</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># curl -O ftp://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz<br />
# tar zxvf js-1.7.0.tar.gz<br />
# cd js/src<br />
# export CFLAGS=&quot;-DJS_C_STRINGS_ARE_UTF8&quot;<br />
# make -f Makefile.ref<br />
# JS_DIST=/usr make -f Makefile.ref export</div></div>
<p>2. 安装scons，用<a href="http://www.scons.org/download.php">官网</a>的rpm包就行。</p>
<p>3. 重新编译pcre。自带的编译时没带&#8211;enable-unicode-properties参数，mongdb启动时会提示：warning: some regex utf8 things will not work.  pcre build doesn&#8217;t have &#8211;enable-unicode-properties. RPMS包是在<a href="http://rpm.pbone.net/">这里</a>找到的。</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># rpm -ivh pcre-6.6-2.el5_1.7.src.rpm<br />
# vi /usr/src/redhat/SPECS/pcre.spec<br />
%configure --enable-utf8<br />
修改成<br />
%configure --enable-utf8 --enable-unicode-properties<br />
# rpmbuild -ba /usr/src/redhat/SPECS/pcre.spec<br />
# rpm -Uvh /usr/src/redhat/RPMS/x86_64/pcre*.rpm</div></div>
<p>4. 安装1.41版本的boost库。<a href="http://pkgs.org/centos-5-rhel-5/epel-x86_64/boost141-1.41.0-2.el5.x86_64.rpm.html">这里</a>可以找到编译好的boost库的RPM包。因为后面要编译成静态库，还需要安装boost141-static-1.41.0-2.el5.i386.rpm</p>
<p>5. 开始编译MongoDB</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cd mongodb-src-r1.8.1<br />
# scons --libpath=/usr/lib64/boost141/ \<br />
&nbsp; &nbsp;--cpppath=/usr/include/boost141/ \<br />
&nbsp; &nbsp;--release --64 --static all</div></div>
<p>如果你没有&#8211;release和&#8211;static选项，可能会看见下面这样的消息<br />
 *** notice: no readline library, mongo shell will not have nice interactive line editing ***<br />
解决方法是加上&#8211;extralib=ncurses。</p>
<p>6. 安装</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cd mongodb-src-r1.8.1<br />
# scons --libpath=/usr/lib64/boost141/ \<br />
&nbsp; &nbsp;--cpppath=/usr/include/boost141/ \<br />
&nbsp; &nbsp;--release --64 --static --prefix=/opt/mongo-1.8.1 install</div></div>
<p>参考：<br />
1. <a href="http://www.mongodb.org/display/DOCS/Building+for+Linux">http://www.mongodb.org/display/DOCS/Building+for+Linux</a><br />
2. <a href="http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html">http://hi.baidu.com/farmerluo/blog/item/37364623f35ba55e9922ed2f.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/rhel5%e4%b8%8b%e7%bc%96%e8%af%91mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Postgresql</title>
		<link>http://guoyong.me/linux/sysadm/using-postgresql/</link>
		<comments>http://guoyong.me/linux/sysadm/using-postgresql/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 05:56:45 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[postgis]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=595</guid>
		<description><![CDATA[1. create tablespace $ mkdir -p /home/postgresql/data $ sudo chown -R postres:postres /home/postgresql/data $ sudo chmod -R og-rx /home/postgresql/data $ sudo su &#8211; postgres $ psql postgres=# create tablespace newspace location &#8216;/home/postgresql/data&#8217;; 2. move a database to this new tablespace &#8230; <a href="http://guoyong.me/linux/sysadm/using-postgresql/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>1. create tablespace<br />
$ mkdir -p /home/postgresql/data<br />
$ sudo chown -R postres:postres /home/postgresql/data<br />
$ sudo chmod -R og-rx /home/postgresql/data<br />
$ sudo su &#8211; postgres<br />
$ psql<br />
postgres=# create tablespace newspace location &#8216;/home/postgresql/data&#8217;;</p>
<p>2. move a database to this new tablespace<br />
use a php script from <a href="http://blog.lodeblomme.be/2008/03/15/move-a-postgresql-database-to-a-different-tablespace/">here</a> to generate sql<br />
$ sudo yum install php-pgsql<br />
$ ./generate-mv-db.php<br />
$ sudo su &#8211; postgres<br />
$ psql -d mydb -f migrate_localhost_mydb_newspace.sql</p>
<p>3. install postgis<br />
a. install proj4.7<br />
$ sudo yum install proj<br />
b. install geos 3.2.2<br />
$ tar xvjf geos-3.2.2.tar.bz2<br />
$ cd geos-3.2.2<br />
$ ./configure &#8211;prefix=/usr<br />
$ make &#038;&#038; sudo make install<br />
$ sudo ldconfig </p>
<blockquote><p> must do this, otherwise postgis will fail to locate libgeos_c.so.1
</p></blockquote>
<p>c. install postgis-1.5.1.tar.gz<br />
$ tar xvzf postgis-1.5.1.tar.gz<br />
$ cd postgis-1.5.1<br />
$ ./configure<br />
$ make &#038;&#038; sudo make install<br />
d. create a spatially-enabled database<br />
$ sudo su &#8211; postgres<br />
$ createdb postgis_template -U postgres;<br />
$ cd /usr/share/pgsql/contrib/postgis-1.5<br />
$ createlang plpgsql postgis_template<br />
$ psql -d postgis_template -f postgis.sql<br />
$ psql -d postgis_template -f spatial_ref_sys.sql</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/using-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH:不用密码登录</title>
		<link>http://guoyong.me/linux/sysadm/%e4%b8%8d%e7%94%a8%e5%af%86%e7%a0%81%e6%9d%a5ssh%e7%99%bb%e5%bd%95/</link>
		<comments>http://guoyong.me/linux/sysadm/%e4%b8%8d%e7%94%a8%e5%af%86%e7%a0%81%e6%9d%a5ssh%e7%99%bb%e5%bd%95/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 08:31:22 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=569</guid>
		<description><![CDATA[用SSH登录远程主机，每次都输入密码挺麻烦的，其实可以用密钥文件来登录： 1. 用ssh-keygen命令生成private/public密钥对，提示问题都用默认回答即可。 $ ssh-keygenGenerating public/private rsa key pair.Enter file in which to save the key (/home/guoyong/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/guoyong/.ssh/id_rsa.Your public key has been saved in &#8230; <a href="http://guoyong.me/linux/sysadm/%e4%b8%8d%e7%94%a8%e5%af%86%e7%a0%81%e6%9d%a5ssh%e7%99%bb%e5%bd%95/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>用SSH登录远程主机，每次都输入密码挺麻烦的，其实可以用密钥文件来登录：<br />
1. 用ssh-keygen命令生成private/public密钥对，提示问题都用默认回答即可。</p>
<div class="hl-surround"><div class="hl-main">$ ssh-keygen<br />Generating public/private rsa key pair.<br />Enter file in which to save the key (/home/guoyong/.ssh/id_rsa): <br />Enter passphrase (empty for no passphrase): <br />Enter same passphrase again: <br />Your identification has been saved in /home/guoyong/.ssh/id_rsa.<br />Your public key has been saved in /home/guoyong/.ssh/id_rsa.pub.</div></div>
<p>2. 用ssh-copy-id命令把公钥复制到远程主机上，user就是你登录用的用户名</p>
<div class="hl-surround"><div class="hl-main">$ ssh-cody-id user@remotehost</div></div>
<p>3. 验证一下吧</p>
<div class="hl-surround"><div class="hl-main">$ ssh user@remotehost echo &quot;it works&quot;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e4%b8%8d%e7%94%a8%e5%af%86%e7%a0%81%e6%9d%a5ssh%e7%99%bb%e5%bd%95/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>nrpe使用一例</title>
		<link>http://guoyong.me/linux/sysadm/nrpe%e4%bd%bf%e7%94%a8%e4%b8%80%e4%be%8b/</link>
		<comments>http://guoyong.me/linux/sysadm/nrpe%e4%bd%bf%e7%94%a8%e4%b8%80%e4%be%8b/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 07:22:25 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[监控]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[nrpe]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=548</guid>
		<description><![CDATA[NRPE的作用是在远程主机上运行Nagios插件，以便监控远程主机。 Ubuntu Server下安装NRPE很方便： $ sudo apt-get install nagios-nrpe-server nagios-plugins 默认的几个检查命令(check_users, check_load等)都已经在/etc/naigos/nrpe.cfg和/etc/nagios/nrpe_local.cfg配置好了。在Nagios里配置监控服务使用类似如下的监控命令就可以了： check_command&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;check_nrpe!check_load 如果需要自定义监控命令，只需在/etc/nagios/nrpe_local.cfg里设置，重启NRPE服务，再在Nagios里配置监控服务即可。比如，要添加一个监控TCP各种状态的命令，步骤如下： @remotehost$ cd /usr/lib/nagios/plugins$ sudo wget http://www.tuschy.com/nagios/plugins/check_tcp_count$ sudo chmod +x check_tcp_count$ cd /etc/nagios$ sudo vi nrpe_local.cfgcommand[check_tcp_count]=/usr/lib/nagios/plugins/check_tcp_count$ sudo service nagios-nrpe-server &#8230; <a href="http://guoyong.me/linux/sysadm/nrpe%e4%bd%bf%e7%94%a8%e4%b8%80%e4%be%8b/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>NRPE的作用是在远程主机上运行Nagios插件，以便监控远程主机。</p>
<p>Ubuntu Server下安装NRPE很方便：</p>
<div class="hl-surround"><div class="hl-main">$ sudo apt-get install nagios-nrpe-server nagios-plugins</div></div>
<p>默认的几个检查命令(check_users, check_load等)都已经在/etc/naigos/nrpe.cfg和/etc/nagios/nrpe_local.cfg配置好了。在Nagios里配置监控服务使用类似如下的监控命令就可以了：</p>
<div class="hl-surround"><div class="hl-main">check_command&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;check_nrpe!check_load</div></div>
<p>如果需要自定义监控命令，只需在/etc/nagios/nrpe_local.cfg里设置，重启NRPE服务，再在Nagios里配置监控服务即可。比如，要添加一个监控TCP各种状态的命令，步骤如下：</p>
<div class="hl-surround"><div class="hl-main">@remotehost<br />$ cd /usr/lib/nagios/plugins<br />$ sudo wget http://www.tuschy.com/nagios/plugins/check_tcp_count<br />$ sudo chmod +x check_tcp_count<br />$ cd /etc/nagios<br />$ sudo vi nrpe_local.cfg<br />command[check_tcp_count]=/usr/lib/nagios/plugins/check_tcp_count<br />$ sudo service nagios-nrpe-server restart<br /><br />@nagioshost<br />$ sudo vi remotehost.cfg<br />define service{<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;use&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; generic-service<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;host_name&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; remotehostname<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;service_description&nbsp; &nbsp; &nbsp; &nbsp; Tcp count<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;check_command&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; check_nrpe!check_tcp_count<br />}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/nrpe%e4%bd%bf%e7%94%a8%e4%b8%80%e4%be%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Cacti监控JVM</title>
		<link>http://guoyong.me/linux/sysadm/%e4%bd%bf%e7%94%a8cacti%e7%9b%91%e6%8e%a7jvm/</link>
		<comments>http://guoyong.me/linux/sysadm/%e4%bd%bf%e7%94%a8cacti%e7%9b%91%e6%8e%a7jvm/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 08:55:59 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[监控]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=512</guid>
		<description><![CDATA[Cacti官方论坛里有几个监控JVM的模板： http://forums.cacti.net/about19761.html http://forums.cacti.net/post-112268.html 导入到Cacti后，需要启用JVM的SNMP Agent，方法如下： 1. 启动JVM的参数里加入-Dcom.sun.management.snmp.port=9998 这个是指定SNMP Agent的监听端口。 2. 设置访问权限 $ sudo cp $JRE_HOME/lib/management/snmp.acl.template $JRE_HOME/lib/management/snmp.acl$ sudo vi $JRE_HOME/lib/management/snmp.aclacl = {&#160; {&#160;&#160; &#160;communities = public, private&#160;&#160; &#160;access = read-only&#160;&#160; &#160;managers = localhost&#160; }}trap = {&#160; {&#160;&#160; &#160;trap-community = public&#160;&#160; &#160;hosts &#8230; <a href="http://guoyong.me/linux/sysadm/%e4%bd%bf%e7%94%a8cacti%e7%9b%91%e6%8e%a7jvm/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Cacti官方论坛里有几个监控JVM的模板：</p>
<ul>
<li><a href="http://forums.cacti.net/about19761.html">http://forums.cacti.net/about19761.html</a></li>
<li>
<a href="http://forums.cacti.net/post-112268.html">http://forums.cacti.net/post-112268.html</a></li>
</ul>
<p>导入到Cacti后，需要启用JVM的SNMP Agent，方法如下：<br />
1. 启动JVM的参数里加入-Dcom.sun.management.snmp.port=9998 这个是指定SNMP Agent的监听端口。<br />
2. 设置访问权限</p>
<div class="hl-surround"><div class="hl-main">$ sudo cp $JRE_HOME/lib/management/snmp.acl.template $JRE_HOME/lib/management/snmp.acl<br />$ sudo vi $JRE_HOME/lib/management/snmp.acl<br /><br />acl = {<br />&nbsp; {<br />&nbsp;&nbsp; &nbsp;communities = public, private<br />&nbsp;&nbsp; &nbsp;access = read-only<br />&nbsp;&nbsp; &nbsp;managers = localhost<br />&nbsp; }<br />}<br /><br />trap = {<br />&nbsp; {<br />&nbsp;&nbsp; &nbsp;trap-community = public<br />&nbsp;&nbsp; &nbsp;hosts = localhost<br />&nbsp; }<br />}</div></div>
<p>3. 设置配置文件的权限，必须只能为启用JVM的用户只读，否则不能工作。(management.properties不用修改，使用默认配置即可)</p>
<div class="hl-surround"><div class="hl-main">$ sudo chmod 600 management.properties snmp.acl<br />$ sudo chown jetty management.properties snmp.acl</div></div>
<p>4. 重启JVM，用netstat命令检查9998端口是否已被监听或用snmpwalk命令检查。</p>
<div class="hl-surround"><div class="hl-main">$ sudo netstat -tlunp |grep 9998<br />$ snmpwalk -v 2c -c public localhost:9998 .1.3.6.1.4.1.42</div></div>
<p>5. 为了让远程的Cacti主机可以访问，可使用snmpd的proxy功能将请求转发到localhost的JVM SNMP Agent上。修改snmpd的配置文件，添加<br />
proxy -v 2c -c public localhost:9998 .1.3.6.1.4.1.42<br />
然后重启snmpd服务。在Cacti主机上以snmpwalk命令检查，应该能得到与上一步中snmpwalk命令一样的输出。snmpwalk -v 2c -c public remotehost .1.3.6.1.4.1.42<br />
6. 至此，可以在Cacti里为JVM主机添加监控图表了，注意Device的SNMP Options配置里SNMP Version要选择Version 2。</p>
<p>参考：</p>
<ul>
<li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/snmp.html">http://java.sun.com/javase/6/docs/technotes/guides/management/snmp.html</a></li>
<li>
<a href="http://www.fifi.org/cgi-bin/man2html/usr/share/man/man5/snmpd.conf.5snmp.gz">http://www.fifi.org/cgi-bin/man2html/usr/share/man/man5/snmpd.conf.5snmp.gz</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e4%bd%bf%e7%94%a8cacti%e7%9b%91%e6%8e%a7jvm/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>再次遭遇大量CLOSE_WAIT</title>
		<link>http://guoyong.me/linux/sysadm/%e5%86%8d%e6%ac%a1%e9%81%ad%e9%81%87%e5%a4%a7%e9%87%8fclose_wait/</link>
		<comments>http://guoyong.me/linux/sysadm/%e5%86%8d%e6%ac%a1%e9%81%ad%e9%81%87%e5%a4%a7%e9%87%8fclose_wait/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 12:51:05 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[CLOSE_WAIT]]></category>
		<category><![CDATA[HttpClient]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=543</guid>
		<description><![CDATA[今天下午线上的Jetty服务又停止响应了。不过与上次不同的是，日志里没有Too many open files的问题（看来ulimit设置管用了），看不出任何问题。于是用netstat检查网络连接，发现了大量CLOSE_WAIT状态的连接，而且都是连接到同一个IP地址。联想到程序里有调用外部网站服务的部分，检查这个IP，正是其中的一个服务。检查代码，发现开发人员使用Commons HttpClient时出了问题，居然忘记关闭连接了(method.releaseConnection();)！！后果就是对方关闭了连接，连接不断地变成CLOSE_WAIT状态，直到耗尽所有的网络资源，没法再建立连接了。 从这个教训看出，项目的研发管理真是没有到位啊！快速反复的需求、几乎可以忽略的设计、缺少代码走查、没有单元测试，怎能保证上线前发现这样的问题！]]></description>
			<content:encoded><![CDATA[<p>今天下午线上的Jetty服务又停止响应了。不过与上次不同的是，日志里没有Too many open files的问题（看来ulimit设置管用了），看不出任何问题。于是用netstat检查网络连接，发现了大量CLOSE_WAIT状态的连接，而且都是连接到同一个IP地址。联想到程序里有调用外部网站服务的部分，检查这个IP，正是其中的一个服务。检查代码，发现开发人员使用Commons HttpClient时出了问题，居然忘记关闭连接了(method.releaseConnection();)！！后果就是对方关闭了连接，连接不断地变成CLOSE_WAIT状态，直到耗尽所有的网络资源，没法再建立连接了。</p>
<p>从这个教训看出，项目的研发管理真是没有到位啊！快速反复的需求、几乎可以忽略的设计、缺少代码走查、没有单元测试，怎能保证上线前发现这样的问题！</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e5%86%8d%e6%ac%a1%e9%81%ad%e9%81%87%e5%a4%a7%e9%87%8fclose_wait/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>遭遇&#8221;java.io.IOException: Too many open files&#8221;</title>
		<link>http://guoyong.me/linux/sysadm/%e9%81%ad%e9%81%87java-io-ioexception-too-many-open-files/</link>
		<comments>http://guoyong.me/linux/sysadm/%e9%81%ad%e9%81%87java-io-ioexception-too-many-open-files/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 08:47:21 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=520</guid>
		<description><![CDATA[今天下午，线上的Jetty服务宕机了，日志里大量的&#8221;java.io.IOException: Too many open files&#8221;错误。搜索到Freddy Chu的博客里正好有关于此的解决办法。 $ sysctl fs.file-max$ lsof -u jetty -nn &#124; wc -l$ ulimit -a$ sudo vi /etc/security/limits.conf* soft nofile 65535* hard nofile 65535 同时发现了系统里也有Freddy Chu提到的&#8221;Too many CLOSE_WAIT&#8221;问题，谢谢Freddy Chu。 $ sudo vi /etc/sysctl.confnet.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_intvl = 2net.ipv4.tcp_keepalive_probes &#8230; <a href="http://guoyong.me/linux/sysadm/%e9%81%ad%e9%81%87java-io-ioexception-too-many-open-files/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>今天下午，线上的Jetty服务宕机了，日志里大量的&#8221;java.io.IOException: Too many open files&#8221;错误。搜索到<a href="http://tux.hk/">Freddy Chu</a>的博客里正好有关于此的解决办法。</p>
<div class="hl-surround"><div class="hl-main">$ sysctl fs.file-max<br />$ lsof -u jetty -nn | wc -l<br />$ ulimit -a<br />$ sudo vi /etc/security/limits.conf<br />* soft nofile 65535<br />* hard nofile 65535</div></div>
<p>同时发现了系统里也有Freddy Chu提到的&#8221;Too many CLOSE_WAIT&#8221;问题，谢谢Freddy Chu。</p>
<div class="hl-surround"><div class="hl-main">$ sudo vi /etc/sysctl.conf<br />net.ipv4.tcp_fin_timeout = 30<br />net.ipv4.tcp_keepalive_intvl = 2<br />net.ipv4.tcp_keepalive_probes = 2<br />net.ipv4.tcp_keepalive_time = 1800<br /><br />$ sudo sysctl -p</div></div>
<blockquote><p>Update(2010-01-21): root用户要特殊设置</p>
<div class="hl-surround"><div class="hl-main">$ sudo vi /etc/security/limits.conf<br />root soft nofile 65535<br />root hard nofile 65535</div></div>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e9%81%ad%e9%81%87java-io-ioexception-too-many-open-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>npc安装问题解决一例</title>
		<link>http://guoyong.me/linux/sysadm/npc%e5%ae%89%e8%a3%85%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e4%b8%80%e4%be%8b/</link>
		<comments>http://guoyong.me/linux/sysadm/npc%e5%ae%89%e8%a3%85%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e4%b8%80%e4%be%8b/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 12:27:34 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[监控]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[运维]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[npc]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=504</guid>
		<description><![CDATA[Cacti和Nagios都是好用的运维监控软件，NPC(Nagios Plugin for Cacti)是一个Cacti插件，安装后可以在Cacti界面里使用Nagios的功能。官方安装文档在这里。 我的安装环境是这样的： Ubuntu 6.06 LTS PHP 5.1.2 Cacti 0.8.7e Cacti Plugin Architecture 2.6 Nagios 3.2.0 NDOUtils 1.4b7 PHP必须安装PDO 和 JSON扩展。由于NPC使用了Ext JS，如果没有JSON扩展，NPC的界面不会出来，只能看到一个空白页面。Ubuntu 6.06下安装PDO可以参考这里。 按照官方文档安装配置好后，遇到了没有显示任何数据的问题，host, hostgroup, service, servicegroup等等都看不到。 检查了NPC的数据库表，有数据，说明NDOUtils已经工作。没有出现在界面上，说明是NPC从数据库读出来到界面显示过程中出现的问题。 用Firebug找出NPC界面为了获取显示数据的Ajax请求(比如/cacti/plugins/npc/npc.php?module=servicegroups&#038;action=getHostStatusPortlet)，直接在浏览器里访问，可以看到出了异常：Fatal error: Uncaught exception &#8216;Doctrine_Exception&#8217; with message &#8216;Couldn&#8217;t find class &#8230; <a href="http://guoyong.me/linux/sysadm/npc%e5%ae%89%e8%a3%85%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e4%b8%80%e4%be%8b/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cacti.net/">Cacti</a>和<a href="http://www.nagios.org/">Nagios</a>都是好用的运维监控软件，<a href="http://trac2.assembla.com/npc/">NPC</a>(Nagios Plugin for Cacti)是一个Cacti插件，安装后可以在Cacti界面里使用Nagios的功能。官方安装文档在<a href="http://trac2.assembla.com/npc/wiki/QuickStartGuide">这里</a>。</p>
<p>我的安装环境是这样的：</p>
<ul>
<li>Ubuntu 6.06 LTS</li>
<li>PHP 5.1.2</li>
<li>Cacti 0.8.7e</li>
<li><a href="http://cactiusers.org/downloads/">Cacti Plugin Architecture 2.6</a></li>
<li>Nagios 3.2.0</li>
<li>NDOUtils 1.4b7</li>
</ul>
<p>PHP必须安装PDO 和 JSON扩展。由于NPC使用了Ext JS，如果没有JSON扩展，NPC的界面不会出来，只能看到一个空白页面。Ubuntu 6.06下安装PDO可以参考<a href="http://bhiv.com/getting-pdo-to-work-with-ubuntus-606-lts-dapper-drake/">这里</a>。</p>
<p>按照官方文档安装配置好后，遇到了没有显示任何数据的问题，host, hostgroup, service, servicegroup等等都看不到。</p>
<p>检查了NPC的数据库表，有数据，说明NDOUtils已经工作。没有出现在界面上，说明是NPC从数据库读出来到界面显示过程中出现的问题。</p>
<p>用Firebug找出NPC界面为了获取显示数据的Ajax请求(比如/cacti/plugins/npc/npc.php?module=servicegroups&#038;action=getHostStatusPortlet)，直接在浏览器里访问，可以看到出了异常：Fatal error: Uncaught exception &#8216;Doctrine_Exception&#8217; with message &#8216;Couldn&#8217;t find class NpcServicegroups&#8217; 。显然是Doctrine没有加载到NPC定义的领域类。</p>
<p>经过一番对Doctrine的调试，发现原因在Doctrine类的loadModels方法(Line 516 in Doctrine.php)</p>
<div class="hl-surround"><div class="hl-main"><span style="color: #00008b;">$e</span><span style="color: Gray;"> = </span><span style="color: Blue;">explode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">.</span><span style="color: #8b0000;">'</span><span style="color: Gray;">, </span><span style="color: #00008b;">$file</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">getFileName</span><span style="color: Olive;">())</span><span style="color: Gray;">;</span></div></div>
<p>这里getFileName返回了带绝对路径的文件名，导致autoload函数失败。改成下面这样就解决了。</p>
<div class="hl-surround"><div class="hl-main"><span style="color: #00008b;">$e</span><span style="color: Gray;"> = </span><span style="color: Blue;">explode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">.</span><span style="color: #8b0000;">'</span><span style="color: Gray;">, </span><span style="color: Blue;">basename</span><span style="color: Olive;">(</span><span style="color: #00008b;">$file</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">getFileName</span><span style="color: Olive;">()))</span><span style="color: Gray;">;</span></div></div>
<p>不过还是不明白为什么getFileName返回的是带绝对路径的文件名，是跟我的系统环境有关系吗？有熟悉PHP的朋友能解释一下就好了。</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/npc%e5%ae%89%e8%a3%85%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3%e4%b8%80%e4%be%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Nginx from source with &#8216;Debian&#8217; layout</title>
		<link>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/</link>
		<comments>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 08:10:56 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=371</guid>
		<description><![CDATA[1. 创建相关目录 $ sudo mkdir /etc/nginx$ sudo mkdir /etc/nginx/conf.d$ sudo mkdir /etc/nginx/sites-available$ sudo mkdir /etc/nginx/sites-enabled$ sudo mkdir /var/log/nginx$ sudo mkdir -p /var/lib/nginx/body$ sudo mkdir /var/lib/nginx/proxy$ sudo mkdir /var/lib/nginx/fastcgi 2. 编译安装 $ ./configure --prefix=/usr \--sbin-path=/usr/sbin/nginx \--conf-path=/etc/nginx/nginx.conf \--lock-path=/var/lock/nginx.lock \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--user=www-data &#8230; <a href="http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>1. 创建相关目录</p>
<div class="hl-surround"><div class="hl-main">$ sudo mkdir /etc/nginx<br />$ sudo mkdir /etc/nginx/conf.d<br />$ sudo mkdir /etc/nginx/sites-available<br />$ sudo mkdir /etc/nginx/sites-enabled<br />$ sudo mkdir /var/log/nginx<br />$ sudo mkdir -p /var/lib/nginx/body<br />$ sudo mkdir /var/lib/nginx/proxy<br />$ sudo mkdir /var/lib/nginx/fastcgi</div></div>
<p>2. 编译安装</p>
<div class="hl-surround"><div class="hl-main">$ ./configure --prefix=/usr \<br />--sbin-path=/usr/sbin/nginx \<br />--conf-path=/etc/nginx/nginx.conf \<br />--lock-path=/var/lock/nginx.lock \<br />--error-log-path=/var/log/nginx/error.log \<br />--http-log-path=/var/log/nginx/access.log \<br />--pid-path=/var/run/nginx.pid \<br />--user=www-data \<br />--group=www-data \<br />--http-client-body-temp-path=/var/lib/nginx/body \<br />--http-proxy-temp-path=/var/lib/nginx/proxy \<br />--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \<br />--with-md5=/usr/lib \<br />--with-sha1=/usr/lib \<br />--with-http_ssl_module \<br />--with-http_gzip_static_module \<br />--with-pcre \<br />--without-mail_pop3_module \<br />--without-mail_imap_module \<br />--without-mail_smtp_module \<br />--with-http_stub_status_module<br /><br />$ make<br />$ sudo make install<br />$ sudo mv /usr/html /var/www/nginx-default</div></div>
<p>3. 修改配置文件<br />
/etc/nginx/nginx.conf</p>
<div class="hl-surround"><div class="hl-main">user www-data;<br />worker_processes&nbsp; 5;<br /><br />error_log&nbsp; /var/log/nginx/error.log;<br />pid&nbsp; &nbsp; &nbsp; &nbsp; /var/run/nginx.pid;<br /><br />events {<br />&nbsp;&nbsp; &nbsp;worker_connections&nbsp; 1024;<br />}<br /><br />http {<br />&nbsp;&nbsp; &nbsp;server_tokens off;<br />&nbsp;&nbsp; &nbsp;include&nbsp; &nbsp; &nbsp; &nbsp;/etc/nginx/mime.types;<br />&nbsp;&nbsp; &nbsp;default_type&nbsp; application/octet-stream;<br /><br />&nbsp;&nbsp; &nbsp;access_log&nbsp; /var/log/nginx/access.log;<br /><br />&nbsp;&nbsp; &nbsp;sendfile&nbsp; &nbsp; &nbsp; &nbsp; on;<br />&nbsp;&nbsp; &nbsp;#tcp_nopush&nbsp; &nbsp; &nbsp;on;<br /><br />&nbsp;&nbsp; &nbsp;#keepalive_timeout&nbsp; 0;<br />&nbsp;&nbsp; &nbsp;keepalive_timeout&nbsp; 65;<br />&nbsp;&nbsp; &nbsp;tcp_nodelay&nbsp; &nbsp; &nbsp; &nbsp; on;<br />&nbsp;&nbsp; &nbsp;gzip&nbsp; on;<br /><br />&nbsp;&nbsp; &nbsp;include /etc/nginx/conf.d/*.conf;<br />&nbsp;&nbsp; &nbsp;include /etc/nginx/sites-enabled/*;<br />}</div></div>
<p>/etc/nginx/sites-available/default</p>
<div class="hl-surround"><div class="hl-main">server {<br />&nbsp;&nbsp; &nbsp;listen&nbsp; &nbsp; &nbsp; &nbsp;80;<br />&nbsp;&nbsp; &nbsp;server_name&nbsp; localhost;<br /><br />&nbsp;&nbsp; &nbsp;location / {<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;root&nbsp; &nbsp;/var/www/nginx-default;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;index&nbsp; index.html index.htm;<br />&nbsp;&nbsp; &nbsp;}<br /><br /><br />&nbsp;&nbsp; &nbsp;# redirect server error pages to the static page /50x.html<br />&nbsp;&nbsp; &nbsp;#<br />&nbsp;&nbsp; &nbsp;error_page&nbsp; &nbsp;500 502 503 504&nbsp; /50x.html;<br />&nbsp;&nbsp; &nbsp;location = /50x.html {<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;root&nbsp; &nbsp;/var/www/nginx-default;<br />&nbsp;&nbsp; &nbsp;}<br />}</div></div>
<p>启用default vhost</p>
<div class="hl-surround"><div class="hl-main">sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default</div></div>
<p>4. 创建init脚本<br />
$ sudo vi /etc/init.d/nginx</p>
<div class="hl-surround"><div class="hl-main">#! /bin/sh<br /><br />### BEGIN INIT INFO<br /># Provides:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nginx<br /># Required-Start:&nbsp; &nbsp; $all<br /># Required-Stop:&nbsp; &nbsp; &nbsp;$all<br /># Default-Start:&nbsp; &nbsp; &nbsp;2 3 4 5<br /># Default-Stop:&nbsp; &nbsp; &nbsp; 0 1 6<br /># Short-Description: starts the nginx web server<br /># Description:&nbsp; &nbsp; &nbsp; &nbsp;starts nginx using start-stop-daemon<br />### END INIT INFO<br /><br />PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br />DAEMON=/usr/sbin/nginx<br />NAME=nginx<br />DESC=nginx<br /><br />test -x $DAEMON || exit 0<br /><br /># Include nginx defaults if available<br />if [ -f /etc/default/nginx ] ; then<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;. /etc/default/nginx<br />fi<br /><br />set -e<br /><br />. /lib/lsb/init-functions<br /><br />case &quot;$1&quot; in<br />&nbsp; start)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Starting $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON -- $DAEMON_OPTS || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; stop)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Stopping $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; restart|force-reload)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo -n &quot;Restarting $DESC: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --stop --quiet --pidfile \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/run/$NAME.pid --exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sleep 1<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;start-stop-daemon --start --quiet --pidfile \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />&nbsp; reload)<br />&nbsp;&nbsp; &nbsp; &nbsp;echo -n &quot;Reloading $DESC configuration: &quot;<br />&nbsp;&nbsp; &nbsp; &nbsp;start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;--exec $DAEMON || true<br />&nbsp;&nbsp; &nbsp; &nbsp;echo &quot;$NAME.&quot;<br />&nbsp;&nbsp; &nbsp; &nbsp;;;<br />&nbsp; status)<br />&nbsp;&nbsp; &nbsp; &nbsp;status_of_proc -p /var/run/$NAME.pid &quot;$DAEMON&quot; nginx &amp;&amp; exit 0 || exit $?<br />&nbsp;&nbsp; &nbsp; &nbsp;;;<br />&nbsp; *)<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;N=/etc/init.d/$NAME<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo &quot;Usage: $N {start|stop|restart|reload|force-reload|status}&quot; &gt;&amp;2<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit 1<br />&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;;;<br />esac<br /><br />exit 0</div></div>
<p>$ sudo chmod +x /etc/init.d/nginx<br />
$ sudo /usr/sbin/update-rc.d -f nginx defaults</p>
<p>5. 启动、停止、重启nginx服务</p>
<div class="hl-surround"><div class="hl-main">sudo /etc/init.d/nginx start<br />sudo /etc/init.d/nginx stop<br />sudo /etc/init.d/nginx restart</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/how-to-install-nginx-from-source-with-debian-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在Ubuntu下安装OpenIPMP服务器</title>
		<link>http://guoyong.me/linux/sysadm/ubuntu-installed-in-the-next-openipmp/</link>
		<comments>http://guoyong.me/linux/sysadm/ubuntu-installed-in-the-next-openipmp/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 08:47:17 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[oma]]></category>
		<category><![CDATA[openipmp]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=363</guid>
		<description><![CDATA[1. 如果你用JDK 1.5以上的版本，编译osms过程中会出错，问题在${openipmp_server_src}/osms/src/com/mutable/io/OlLogger.java这个文件中，enum这个变量名跟关键字冲突了，改个名字就好了。 2. 修改${openipmp_server_src}/OMADRMWS/admin_OMADRM.sh，将里面所有的&#8221;$CURR_DIR/../../Demo/data/&#8221;改为 &#8220;/tmp/&#8221;，然后把证书文件复制到/tmp目录下。 cp ${openipmp_server_src}/../Demo/data/* /tmp 这样可避免安装过程中证书无法存入数据库的问题。 3. 修改 ${openipmp_server_src}/ejbca/deployJBoss4x.sh的第16行， if (( $1 == keystore )) 改为 if [ &#34;$1&#34; = &#34;keystore&#34; ] 不然这个脚本复制p12文件时会出错。 4. 运行install.sh脚本安装，如果之前运行过了，先运行uninstall.sh 5. 安装正常结束后，记得一定要在bin目录下执行run.sh来启动JBoss服务器，不然会报错 （“找不到 openIPMP 目录” 、“找不到../conf/server.p12”等等）]]></description>
			<content:encoded><![CDATA[<p>1. 如果你用JDK 1.5以上的版本，编译osms过程中会出错，问题在${openipmp_server_src}/osms/src/com/mutable/io/OlLogger.java这个文件中，enum这个变量名跟关键字冲突了，改个名字就好了。<br />
2. 修改${openipmp_server_src}/OMADRMWS/admin_OMADRM.sh，将里面所有的&#8221;$CURR_DIR/../../Demo/data/&#8221;改为 &#8220;/tmp/&#8221;，然后把证书文件复制到/tmp目录下。</p>
<div class="hl-surround"><div class="hl-main">cp ${openipmp_server_src}/../Demo/data/* /tmp</div></div>
<p>这样可避免安装过程中证书无法存入数据库的问题。<br />
3. 修改 ${openipmp_server_src}/ejbca/deployJBoss4x.sh的第16行，</p>
<div class="hl-surround"><div class="hl-main">if (( $1 == keystore ))</div></div>
<p> 改为  </p>
<div class="hl-surround"><div class="hl-main">if [ &quot;$1&quot; = &quot;keystore&quot; ]</div></div>
<p>不然这个脚本复制p12文件时会出错。<br />
4. 运行install.sh脚本安装，如果之前运行过了，先运行uninstall.sh<br />
5. 安装正常结束后，记得一定要在bin目录下执行run.sh来启动JBoss服务器，不然会报错 （“找不到 openIPMP 目录” 、“找不到../conf/server.p12”等等）</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/ubuntu-installed-in-the-next-openipmp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>一个Python脚本，让OpenVPN使用postfix邮箱帐号进行身份认证</title>
		<link>http://guoyong.me/linux/sysadm/yi-ge-python-jiao-ben-rang-openvpn-shi-yong-postfix-you-xiang-zhang-hao-jin-xing-shen-fen-ren-zheng/</link>
		<comments>http://guoyong.me/linux/sysadm/yi-ge-python-jiao-ben-rang-openvpn-shi-yong-postfix-you-xiang-zhang-hao-jin-xing-shen-fen-ren-zheng/#comments</comments>
		<pubDate>Wed, 14 May 2008 13:27:36 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[md5crypt]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=359</guid>
		<description><![CDATA[这几天配置OpenVPN，使用了用户名密码的身份认证方式，借助已有的postfix邮箱帐号，省去了再为每个人设置用户名密码的麻烦。 原理很简单，OpenVPN服务器配置里有这样一句： auth-user-pass-verify /etc/openvpn/auth-postfix-mailbox.py via-env 就是说要用/etc/openvpn/auth-postfix-mailbox.py这个脚本来验证用户名和密码。用户名和密码如何传递给它呢？via-env，环境变量。 脚本如下： #!/usr/bin/env python &#160; import&#160;os import&#160;sys from&#160;MySQLdb import * import&#160;md5crypt &#160; def&#160;auth(username, password): &#160; conn = connect&#160;(host = 'localhost', &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; user = 'dbuser', &#160; &#160; &#160; &#8230; <a href="http://guoyong.me/linux/sysadm/yi-ge-python-jiao-ben-rang-openvpn-shi-yong-postfix-you-xiang-zhang-hao-jin-xing-shen-fen-ren-zheng/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>这几天配置OpenVPN，使用了用户名密码的身份认证方式，借助已有的postfix邮箱帐号，省去了再为每个人设置用户名密码的麻烦。</p>
<p>原理很简单，OpenVPN服务器配置里有这样一句：</p>
<div class="hl-surround"><div class="hl-main">auth-user-pass-verify /etc/openvpn/auth-postfix-mailbox.py via-env</div></div>
<p>就是说要用/etc/openvpn/auth-postfix-mailbox.py这个脚本来验证用户名和密码。用户名和密码如何传递给它呢？via-env，环境变量。</p>
<p>脚本如下：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: #ffa500;">#!/usr/bin/env python</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Green;">import</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">os</span></li>
<li><span style="color: Green;">import</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sys</span></li>
<li><span style="color: Green;">from</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">MySQLdb</span><span style="color: Gray;"> </span><span style="color: Green;">import</span><span style="color: Gray;"> *</span></li>
<li><span style="color: Green;">import</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">md5crypt</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">auth</span><span style="color: Olive;">(</span><span style="color: Blue;">username</span><span style="color: Gray;">, </span><span style="color: Blue;">password</span><span style="color: Olive;">)</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">conn</span><span style="color: Gray;"> = </span><span style="color: Blue;">connect</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Blue;">host</span><span style="color: Gray;"> = </span><span style="color: #8b0000;">'</span><span style="color: Red;">localhost</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">user</span><span style="color: Gray;"> = </span><span style="color: #8b0000;">'</span><span style="color: Red;">dbuser</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">passwd</span><span style="color: Gray;"> = </span><span style="color: #8b0000;">'</span><span style="color: Red;">dbpasswd</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">db</span><span style="color: Gray;"> = </span><span style="color: #8b0000;">'</span><span style="color: Red;">postfix</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">cursor</span><span style="color: Gray;"> = </span><span style="color: Blue;">conn</span><span style="color: Gray;">.</span><span style="color: Blue;">cursor</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">cursor</span><span style="color: Gray;">.</span><span style="color: Blue;">execute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;&quot;&quot;</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; select password from mailbox </span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; where username=%s</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; and active=1</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; </span><span style="color: #8b0000;">&quot;&quot;&quot;</span><span style="color: Gray;">, </span><span style="color: Olive;">(</span><span style="color: Blue;">username</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">row</span><span style="color: Gray;"> = </span><span style="color: Blue;">cursor</span><span style="color: Gray;">.</span><span style="color: Blue;">fetchone</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">row</span><span style="color: Gray;"> == </span><span style="color: Green;">None</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Maroon;">1</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">crypt</span><span style="color: Gray;"> = </span><span style="color: Blue;">md5crypt</span><span style="color: Gray;">.</span><span style="color: Blue;">md5crypt</span><span style="color: Olive;">(</span><span style="color: Blue;">password</span><span style="color: Gray;">, </span><span style="color: Blue;">row</span><span style="color: Olive;">[</span><span style="color: Maroon;">0</span><span style="color: Olive;">])</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">cursor</span><span style="color: Gray;">.</span><span style="color: Blue;">execute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;&quot;&quot;</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; select * from mailbox</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; where username=%s </span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; and password=%s</span></li>
<li><span style="color: Red;">&nbsp; &nbsp; &nbsp; and active=1</span></li>
<li><span style="color: Red;">&nbsp;&nbsp; </span><span style="color: #8b0000;">&quot;&quot;&quot;</span><span style="color: Gray;">, </span><span style="color: Olive;">(</span><span style="color: Blue;">username</span><span style="color: Gray;">,</span><span style="color: Blue;">crypt</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">row</span><span style="color: Gray;"> = </span><span style="color: Blue;">cursor</span><span style="color: Gray;">.</span><span style="color: Blue;">fetchone</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">cursor</span><span style="color: Gray;">.</span><span style="color: Blue;">close</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">conn</span><span style="color: Gray;">.</span><span style="color: Blue;">close</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">row</span><span style="color: Gray;"> == </span><span style="color: Green;">None</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Maroon;">1</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Maroon;">0</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">main</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">status</span><span style="color: Gray;"> = </span><span style="color: Maroon;">0</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">try</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">username</span><span style="color: Gray;"> = </span><span style="color: Blue;">os</span><span style="color: Gray;">.</span><span style="color: Blue;">environ</span><span style="color: Olive;">[</span><span style="color: #8b0000;">'</span><span style="color: Red;">username</span><span style="color: #8b0000;">'</span><span style="color: Olive;">]</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">password</span><span style="color: Gray;"> = </span><span style="color: Blue;">os</span><span style="color: Gray;">.</span><span style="color: Blue;">environ</span><span style="color: Olive;">[</span><span style="color: #8b0000;">'</span><span style="color: Red;">password</span><span style="color: #8b0000;">'</span><span style="color: Olive;">]</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">status</span><span style="color: Gray;"> = </span><span style="color: Blue;">auth</span><span style="color: Olive;">(</span><span style="color: Blue;">username</span><span style="color: Gray;">, </span><span style="color: Blue;">password</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">sys</span><span style="color: Gray;">.</span><span style="color: Blue;">exit</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">sys</span><span style="color: Gray;">.</span><span style="color: Blue;">exit</span><span style="color: Olive;">(</span><span style="color: Blue;">status</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">__name__</span><span style="color: Gray;"> == </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">__main__</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Blue;">main</span><span style="color: Olive;">()</span></li></ol></div>
<p>由于postfix使用md5认证，所以需要用md5crypt这个模块，从<a href="http://www.sabren.net/code/python/crypt/md5crypt.py">这里</a>可以下载到。</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/yi-ge-python-jiao-ben-rang-openvpn-shi-yong-postfix-you-xiang-zhang-hao-jin-xing-shen-fen-ren-zheng/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>postfix和postgrey问题</title>
		<link>http://guoyong.me/linux/sysadm/postfix-and-postgrey-problem/</link>
		<comments>http://guoyong.me/linux/sysadm/postfix-and-postgrey-problem/#comments</comments>
		<pubDate>Tue, 13 May 2008 14:58:21 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postgrey]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://guoyong.org/?p=358</guid>
		<description><![CDATA[公司的邮件服务器收不到外来邮件了，日志里有这样的错误： 554 Service unavailable; Client host [xxx.xxx.xxx.xxx] blocked using relays.ordb.org; ordb.org was shut down on December 18, 2006. Please remove from your mailserver.; 对应main.cf里的配置是这样的： smtpd_client_restrictions = permit_mynetworks, warn_if_reject reject_rbl_client sbl.spamhaus.org, warn_if_reject reject_rbl_client relays.ordb.org, warn_if_reject reject_rbl_client blackholes.easynet.nl, warn_if_reject reject_rbl_client dnsbl.njabl.org 改成只保留smtpd_client_restrictions &#8230; <a href="http://guoyong.me/linux/sysadm/postfix-and-postgrey-problem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>公司的邮件服务器收不到外来邮件了，日志里有这样的错误：</p>
<div class="hl-surround"><div class="hl-main">554 Service unavailable; Client host [xxx.xxx.xxx.xxx] blocked using relays.ordb.org; ordb.org was shut down on December 18, 2006. Please remove from your mailserver.;</div></div>
<p>对应main.cf里的配置是这样的：</p>
<div class="hl-surround"><div class="hl-main">smtpd_client_restrictions = permit_mynetworks, warn_if_reject reject_rbl_client sbl.spamhaus.org, warn_if_reject reject_rbl_client relays.ordb.org, warn_if_reject reject_rbl_client blackholes.easynet.nl, warn_if_reject reject_rbl_client dnsbl.njabl.org</div></div>
<p>改成只保留smtpd_client_restrictions = permit_mynetworks， 又有新信息出现：</p>
<div class="hl-surround"><div class="hl-main">postfix/smtpd[16212]: warning: problem talking to server 127.0.0.1:60000: Connection timed out</div></div>
<p>127.0.0.1:60000是postgrey工作的端口，用ps和netstat 发现postgrey进程还在，但top命令发现它占用了99%的CPU，而且用/etc/init.d/postgrey stop停不掉，只好kill掉，并改postfix里相应的设置，去掉postgrey检查：</p>
<div class="hl-surround"><div class="hl-main">smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks,permit_sasl_authenticated, reject_non_fqdn_recipient,reject_unauth_destination, check_policy_service inet:127.0.0.1:60000,permit</div></div>
<p>重启postfix，邮件可以收到了。再恢复smtpd_client_restrictions的配置，去掉relays.ordb.org检查，邮件可以收到。顺便搞清楚了warn_if_reject的含义：有它在时并不真正的拒绝邮件。</p>
<p>postgrey的问题还没找到解决办法，不知道为什么会hang在那里，暂时不用它了。</p>
<p>==== 2008-05-14 ====<br />
补充： 将Berkeley DB由原来的4.3升级到4.4以后，postgrey正常了。<br />
搜索到的相关信息：</p>
<p>http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=441069</p>
<p>https://bugs.edge.launchpad.net/ubuntu/gutsy/+source/db4.4/+bug/153996</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/postfix-and-postgrey-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>升级系统导致Postfix的SMTP认证失败（Cyrus-SASL + MySQL）</title>
		<link>http://guoyong.me/linux/sysadm/%e5%8d%87%e7%ba%a7%e7%b3%bb%e7%bb%9f%e5%af%bc%e8%87%b4postfix%e7%9a%84smtp%e8%ae%a4%e8%af%81%e5%a4%b1%e8%b4%a5%ef%bc%88cyrus-sasl-mysql%ef%bc%89/</link>
		<comments>http://guoyong.me/linux/sysadm/%e5%8d%87%e7%ba%a7%e7%b3%bb%e7%bb%9f%e5%af%bc%e8%87%b4postfix%e7%9a%84smtp%e8%ae%a4%e8%af%81%e5%a4%b1%e8%b4%a5%ef%bc%88cyrus-sasl-mysql%ef%bc%89/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 16:38:37 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://guoyong.org/2008/01/29/351</guid>
		<description><![CDATA[日志里这样的错误信息： warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory 最终发现原因：main.cf里smtpd_sasl_path的设置错误，可能是更新修改的。 把smtpd_sasl_path=/etc/postfix/sasl:/usr/lib/sasl2改成smtpd_sasl_path=smtpd后，重启postfix和courier-authdaemon，问题解决。]]></description>
			<content:encoded><![CDATA[<p>日志里这样的错误信息：<br />
warning: SASL authentication problem: unable to open Berkeley db /etc/sasldb2: No such file or directory</p>
<p>最终发现原因：main.cf里smtpd_sasl_path的设置错误，可能是更新修改的。<br />
把smtpd_sasl_path=/etc/postfix/sasl:/usr/lib/sasl2改成smtpd_sasl_path=smtpd后，重启postfix和courier-authdaemon，问题解决。</p>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e5%8d%87%e7%ba%a7%e7%b3%bb%e7%bb%9f%e5%af%bc%e8%87%b4postfix%e7%9a%84smtp%e8%ae%a4%e8%af%81%e5%a4%b1%e8%b4%a5%ef%bc%88cyrus-sasl-mysql%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>同时运行两个mysql实例</title>
		<link>http://guoyong.me/linux/sysadm/%e5%90%8c%e6%97%b6%e8%bf%90%e8%a1%8c%e4%b8%a4%e4%b8%aamysql%e5%ae%9e%e4%be%8b/</link>
		<comments>http://guoyong.me/linux/sysadm/%e5%90%8c%e6%97%b6%e8%bf%90%e8%a1%8c%e4%b8%a4%e4%b8%aamysql%e5%ae%9e%e4%be%8b/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 16:17:05 +0000</pubDate>
		<dc:creator>wolfg</dc:creator>
				<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://guoyong.org/2007/12/09/349</guid>
		<description><![CDATA[运行环境： Ubuntu 6.06 server 1. 修改/etc/mysql/my.cnf 加入 [mysqld_multi]mysqld&#160; &#160; &#160;= /usr/bin/mysqld_safemysqladmin = /usr/bin/mysqladminuser&#160; &#160; &#160; &#160;= multi_adminpassword&#160; &#160;= multipass 把原来的[mysqld]改成[mysqld001]，并加入[mysqld002]，分别配置两个实例，主要是下面这些设置要不同： pid-file socket port datadir 2. 设置用户 $ mysql -u root -S /var/run/mysqld/mysqld.sock -p&#62; GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost' IDENTIFIED &#8230; <a href="http://guoyong.me/linux/sysadm/%e5%90%8c%e6%97%b6%e8%bf%90%e8%a1%8c%e4%b8%a4%e4%b8%aamysql%e5%ae%9e%e4%be%8b/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>运行环境： Ubuntu 6.06 server</p>
<p>1. 修改/etc/mysql/my.cnf</p>
<p>加入</p>
<div class="hl-surround"><div class="hl-main">[mysqld_multi]<br />mysqld&nbsp; &nbsp; &nbsp;= /usr/bin/mysqld_safe<br />mysqladmin = /usr/bin/mysqladmin<br />user&nbsp; &nbsp; &nbsp; &nbsp;= multi_admin<br />password&nbsp; &nbsp;= multipass</div></div>
<p>把原来的[mysqld]改成[mysqld001]，并加入[mysqld002]，分别配置两个实例，主要是下面这些设置要不同：</p>
<ul>
<li>pid-file</li>
<li>socket</li>
<li>port</li>
<li>datadir</li>
</ul>
<p>2. 设置用户</p>
<div class="hl-surround"><div class="hl-main">$ mysql -u root -S /var/run/mysqld/mysqld.sock -p<br />&gt; GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';<br />$ mysql -u root -S /var/run/mysqld/mysqld2.sock -p<br />&gt; GRANT SHUTDOWN ON *.* TO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';</div></div>
<p>3. 测试启动停止命令</p>
<div class="hl-surround"><div class="hl-main">$ mysqld_multi --no-log --config-file=/etc/mysql/my.cnf start 001,002<br />$ mysqld_multi --no-log --config-file=/etc/mysql/my.cnf stop 001,002<br />$ mysqld_multi --no-log --config-file=/etc/mysql/my.cnf report 001,002</div></div>
<p>4. 新建启动脚本 /etc/init.d/mysql-multi替换原来的启动脚本/etc/init.d/mysql</p>
<p>5. 修改/etc/phpmyadmin/config.inc.php，配置如何连接这两个服务器</p>
<div class="hl-surround"><div class="hl-main">$i = 0;<br />$i++;<br />$cfg['Servers'][$i]['host']&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 'localhost'; <br />$cfg['Servers'][$i]['socket']&nbsp; &nbsp; &nbsp; &nbsp; = '/var/run/mysqld/mysqld.sock';&nbsp; <br />$cfg['Servers'][$i]['connect_type']&nbsp; = 'socket'; <br />$cfg['Servers'][$i]['verbose']&nbsp; &nbsp; &nbsp; &nbsp;= 'localhost:3306'; <br />$i++;<br />$cfg['Servers'][$i]['host']&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 'localhost'; <br />$cfg['Servers'][$i]['socket']&nbsp; &nbsp; &nbsp; &nbsp; = '/var/run/mysqld/mysqld2.sock';&nbsp; <br />$cfg['Servers'][$i]['connect_type']&nbsp; = 'socket'; <br />$cfg['Servers'][$i]['verbose']&nbsp; &nbsp; &nbsp; &nbsp;= 'localhost:3307';</div></div>
]]></content:encoded>
			<wfw:commentRss>http://guoyong.me/linux/sysadm/%e5%90%8c%e6%97%b6%e8%bf%90%e8%a1%8c%e4%b8%a4%e4%b8%aamysql%e5%ae%9e%e4%be%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.774 seconds -->

