<?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>臭皮匠 &#187; 技术</title>
	<atom:link href="http://guogoul.com/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://guogoul.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Oct 2010 00:24:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>oom-killer 的发现 与 swap分区搭建</title>
		<link>http://guogoul.com/2010/04/28/oom-killer-swap/</link>
		<comments>http://guogoul.com/2010/04/28/oom-killer-swap/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 08:07:38 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[cacti]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=257</guid>
		<description><![CDATA[很不幸机器最近1周一台跑了3年多的机器挂了两次.为了过好5/1决定好好检查一下情况,不幸的是到目前为止还是没有确认最终的因素.
1.检查案发时间:通过cacti的记录,发现机器发生不幸发生在0点到2点之间.这个时间段是后台定时任务运行的高发期.
2.判断一:夜间机器后台任务太过集中,机器load太高,机器年久老化导致机器不堪重负
3.措施: 排查所有crontab中的任务,注释了其中有可以有计算压力太大的任务.把nagios的load报警设到5以下.
4.结果: 不幸在第二次发生.
5.查询日志: 发现在案发时间的日志中记录有关 oom-killer (out of memory)的记录.难道是这个做怪?有关oom请移步http://www.dbanotes.net/database/linux_outofmemory_oom_killer.html.  看了一下本机的内存.发现没有swap分区(当年装机的同事为了提高工作效率) . 再次观察cacti中的内存趋势.内存第天基本没有free.  细看一下crotab中的任务.发现每天2点左右确实有一个吃内存的awstats有跑着.
6.措施: 添加swap别让oom-killer 工作了.
7.添加SWAP:
7.1:   设置swap路径及大小:    dd if=/dev/zero of=/var/swap bs=1024 count=8192000  (内存4G,swap习惯设为其2倍)
7.2:  设置交换文件:  mkswap /var/swap
7.3: 启用交换分区: swapon /var/swap
7.4: 开机自挂:    在/etc/fstab中加上这一行  /var/swap swap swap defaults 0 0
8: 先到这儿吧,让他跑几天,查看日志看看问题解决情况,祝自己好运,能睡个好觉
]]></description>
		<wfw:commentRss>http://guogoul.com/2010/04/28/oom-killer-swap/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>关于 MYSQL 字符串类型的存储需求</title>
		<link>http://guogoul.com/2010/01/30/storage_requirements_for_string_types/</link>
		<comments>http://guogoul.com/2010/01/30/storage_requirements_for_string_types/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 12:41:14 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=245</guid>
		<description><![CDATA[关于mysql中的列类型如何定义，是一个让初学者让人头痛的问题。列类型的恰当定义是一个数据库高效存储的重要保证,其中字符串类型的定义是最重要也是相对较难的。很不幸到至今我才清楚char，varchar的真正定义方式 。
原因有二.
1.没有亲自动手去试错，文档上说的怎么样，就天真的认为就是那样
2.是看过官方源文档，但没有查看官方原版英文文档
咱们通过对比来加深记忆
1.mysq中文文档http://dev.mysql.com/doc/refman/5.1/zh/column-types.html#storage-requirements
2. mysql英文文档http://dev.mysql.com/doc/refman/5.1-maria/en/storage-requirements.html


对比上面的两张表中char与varchar的描述
char：
中文版: char(M)     M个字节，0  &#60;= M &#60;= 255
英文版:  char(M) M × w bytes,               0 &#60;= M &#60;= 255, where w is               the number of bytes [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2010/01/30/storage_requirements_for_string_types/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>转载 snmp 重要的OID 备忘</title>
		<link>http://guogoul.com/2010/01/21/snmp-oid/</link>
		<comments>http://guogoul.com/2010/01/21/snmp-oid/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 08:33:13 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[snmp]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=238</guid>
		<description><![CDATA[转载自：
1. http://www.sysadmin.md/most-useful-snmp-oids.html
2. http://blog.chinaunix.net/u2/70049/showart_1136607.html
CPU
Percentages of user CPU time (ssCpuUser)
.1.3.6.1.4.1.2021.11.9
Percentages of system CPU time (ssCpuSystem)
.1.3.6.1.4.1.2021.11.10
Percentages of idle CPU time (ssCpuIdle)
.1.3.6.1.4.1.2021.11.11
Load
1 minute Load (laLoad.1)
.1.3.6.1.4.1.2021.10.1.3.1
5 minute Load (laLoad.2)
.1.3.6.1.4.1.2021.10.1.3.2
15 minute Load (laLoad.3)
.1.3.6.1.4.1.2021.10.1.3.3

Memory
Total Swap Size configured for the host (memTotalSwap)
.1.3.6.1.4.1.2021.4.3
Available Swap Space on the host (memAvailSwap)
.1.3.6.1.4.1.2021.4.4
Total Real/Physical Memory Size on the host (memTotalReal)
.1.3.6.1.4.1.2021.4.5
Available Real/Physical Memory Space on the host (memAvailReal)
.1.3.6.1.4.1.2021.4.6
Total RAM [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2010/01/21/snmp-oid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql中索引的限制</title>
		<link>http://guogoul.com/2009/12/10/mysql-index-limi/</link>
		<comments>http://guogoul.com/2009/12/10/mysql-index-limi/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 14:51:23 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=228</guid>
		<description><![CDATA[##摘自mysql的性能调优与架构设计##（备忘）
1.myIsam存储引擎索引键长度的总和不能超过1000字节
2.BLOB和TEXT列只能创建前缘索引
3.Mysql目前不支持函数索引
4.使用不等于(!=或者)的时候，Mysql无法使用 索引
5.过滤字段如果使用 函数运算（如abs(column)）后，mysql无法使用索引
6.join语句中join条件字段类型不一致时，mysql无法使用索引
7.使用like操作的时候，如果条件以通配符开始（&#8221;%abc&#8230;&#8221;）时，mysql无法使用索引
8.使用非等值查询的时候，mysql无法使用hash索引
]]></description>
		<wfw:commentRss>http://guogoul.com/2009/12/10/mysql-index-limi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nagios+libfetion+midpssh 网络监控报警解决一条龙</title>
		<link>http://guogoul.com/2009/09/11/nagioslibfetionmidpssh/</link>
		<comments>http://guogoul.com/2009/09/11/nagioslibfetionmidpssh/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 15:35:13 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://john.renren.in/?p=115</guid>
		<description><![CDATA[nagios: 一款出色的网络数据监控报警工具  http://nagios.org
libfetion:  移动飞信的非官方lib    http://www.libfetion.cn/
midpssh:  移动端的ssh客户端 http://www.xk72.com/midpssh/
当然以上三者的结合，就是要解决服务器问题最快发现，最快通知，最快解决的方案。
在没有搭建这个报警平台之前，每天都在担心中度过，对所有机器的健康状态基本没谱，现在轻松了很多,一些机器都很长时间没登录上去过问了。下面分享一下经验，供所有像我一样的穷网管借鉴，的确只是一条穷人的经验。
一.搭建nagios：
关于nagios的安装，可以上网搜索一大把，这里就不在详细介绍。基本上有两种安装方式：
1。 用apt-get安装现成的软件包。 哈哈简单吧
2.   源码安装，参考资料最好的是官方说明文档,详细的出你的意料 
和cacti一样，nagios在安装的时候就存在一些基本的监控脚本供使用，如果需要一些其它监控脚本可以自己扩展，或者下载一些现成的扩展。呵呵，这个网站提供的扩展够你爽  。
基本配置文件路径:
/usr/local/nagios/etc/nagios.cfg
在nagios.cfg中把很多监控对象都的子配置文件都存放到了 /usr/local/nagios/etc/objects 目录中
nagios提供了监控信息的web与wap展示以及设置。也就是说大部分的工作都可以在web前台完成。
apache的部分配置：


#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order allow,deny
   Allow from all
#  Order deny,allow
#  Deny from all
#  Allow from 127.0.0.1
   [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2009/09/11/nagioslibfetionmidpssh/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>lucene::MultiSearcher解决最近索引的问题</title>
		<link>http://guogoul.com/2009/08/29/lucece_multisearcher/</link>
		<comments>http://guogoul.com/2009/08/29/lucece_multisearcher/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 14:41:14 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[lucene]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=157</guid>
		<description><![CDATA[
需求：
1.索引N天之内的信息
2.索引最新的多少篇文章信息
注：由于信息量比较大，重建索引比较花时间太长。


解决方案:
1.单索引解决方案:
    对所有的信息进行增量索引, 在索引中加入时间轴信息或者文章ID信息。然后定期批量删除掉N天之前或者哪个ID之前的信息
2.多索引搜索解决：
    在建立索引的时候按天或者按ID分别建立不同的索引目录，例如: ~/indexpath/20090817,~/indexpath/20090818&#8230;&#8230;或者~/indexpath/id-200-300,~/indexpath/id-500-600&#8230;&#8230;。在搜索的时候按照需要进行组合索引搜索

个人比较推荐后者，因为它更加的灵活，简单,效率更高。
multisearcher示例code:


ArrayList as= new ArrayList();
Calendar cal = Calendar.getInstance();
String dname = "";
String path = "";
int n=7;  //最近一周的索引
for(int i=0;i]]></description>
		<wfw:commentRss>http://guogoul.com/2009/08/29/lucece_multisearcher/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql，系统架构学习材料分享</title>
		<link>http://guogoul.com/2009/07/29/share_percona_pdf/</link>
		<comments>http://guogoul.com/2009/07/29/share_percona_pdf/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 01:13:39 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=191</guid>
		<description><![CDATA[最近花了点时间看完了国外的大牛在Percona会议上的演讲稿，选了一些个人觉得对我自己有用的Pdf，分享给大家。主要关于数据存储，备份，系统性能优化方面.本来的想法是把这些文档翻译到博客上，又怕糟蹋了人家的作品，还是直接上传原文件吧.由于文件有点大分两个压缩包上传。
learn1
learn2
里面包括以下几个文件:
1.Ideal Achitecture:  主要介绍了mysql表字段与索引的设计
2.Fighting_MySQL_Replication_Lag:介绍如何解决mysql主从复制的延时最小化问题
3.Innodb_Performance_Tuning： innodb相关介绍
4.mysql_pagination：   数据库分页查询的设计问题
5.non_disruptive_backups:  用lvm快照解决数据备份
6.percona_proactive:  dba，系统管理员所要关心的问题
]]></description>
		<wfw:commentRss>http://guogoul.com/2009/07/29/share_percona_pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql: logs-slave-updates备忘</title>
		<link>http://guogoul.com/2009/07/13/logs-slave-updates/</link>
		<comments>http://guogoul.com/2009/07/13/logs-slave-updates/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 14:06:07 +0000</pubDate>
		<dc:creator>shanfeng</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://guogoul.com/?p=184</guid>
		<description><![CDATA[
 --logs-slave-updates
通常情况，从服务器从主服务器接收到的更新不记入它的二进制日志。该选项告诉从服务器将其SQL线程执行的更新记入到从服务器自己的二进制日志。为了使该选项生效，还必须用--logs-bin选项启动从服务器以启用二进制日志。如果想要应用链式复制服务器，应使用--logs-slave-updates。例如，可能你想要这样设置：
A -> B -> C
也就是说，A为从服务器B的主服务器，B为从服务器C的主服务器。为了能工作，B必须既为主服务器又为从服务器。你必须用--logs-bin启动A和B以启用二进制日志，并且用--logs-slave-updates选项启动B。

以上是摘自mysql对于logs-slave-updates启动选项的描述。
当然logs-slave-upates也可以写入my.cnf :
//////////////////
log_slave_updates=1
//////////////////
当然在这种机制下可能有的同学会存在这么个问题：
如果a->b   b->a   这样的双master架构下，a,b都打开log_slave_updates选项会不会出现无限循环的状态。
mysql已经考滤到了这个问题，每条bin-log都会记录执行语句的源server_id.当slave读到语句的server_id等于本身的ID的时候，不会忽略执行，所以我们不用担心a,b会不会无限循环下去。

基于以上这种情况，mysql的replication集群将更加灵活，你如果需要可以做成各种各样的链式复制。比如 a->b   b->a     b中设置log_slave_updates后还可以b->c.   这样a,c中的数据也是一致的。    
测试部分my.cnf

 26 [mysqld2]
 27 pid-file        = /home/shanfeng/mysql/data2/mysqld2.pid
 28 socket          = /home/shanfeng/mysql/data2/mysqld2.sock
 [...]]]></description>
		<wfw:commentRss>http://guogoul.com/2009/07/13/logs-slave-updates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>db file sys params</title>
		<link>http://guogoul.com/2009/06/18/db_filesys/</link>
		<comments>http://guogoul.com/2009/06/18/db_filesys/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:42:06 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://john.renren.in/?p=118</guid>
		<description><![CDATA[1. noatime option mount
2.ext3 ？ mke2fs -j -m1
3. tune2fs -c 0 -i 0 
]]></description>
		<wfw:commentRss>http://guogoul.com/2009/06/18/db_filesys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx静态压缩(ngx_http_gzip_static_module)</title>
		<link>http://guogoul.com/2009/06/14/ngx_http_gzip_static_module/</link>
		<comments>http://guogoul.com/2009/06/14/ngx_http_gzip_static_module/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 12:29:27 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://john.renren.in/?p=123</guid>
		<description><![CDATA[在搭建squid网页加速的时候，对于大的css 或者js要进行压缩,然后再进行缓存,这样能够提高减小下载量提高页面响应速度。如果你用的是squid 3.0以前的版本并且用的是 ngnix server的话可能会碰到如下问题： 不用squid直接打开页面则客户端返回的是压缩的状态，如果启用squid加速会发现下载下来的页面不是压缩状态。这里面主要是没有启动ngnix 的静态缓存模块(ngx_http_gzip_static_module)导致。打开静态缓存问题就解决了
1.nginx编译选项
./configure --with-http_gzip_static_module
2.修改nginx.conf

gzip_static on;
gzip_http_version   1.1;
gzip_proxied        expired no-cache no-store private auth;
gzip_disable        "MSIE [1-6] \.";
gzip_vary           on;

参考：
1.http://wiki.nginx.org/NginxHttpGzipStaticModule
2.http://bbs.chinaunix.net/viewthread.php?tid=1329820
]]></description>
		<wfw:commentRss>http://guogoul.com/2009/06/14/ngx_http_gzip_static_module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

