Skip to content


shell防采集脚本

介绍 脚本使用bash编写,仅作简单防御,增加采集复杂度 原理是通过采集器的特点,请求频率高并只请求关键文件(html,php…),而不请求无关文件(css,js,jp…)来进行筛选并放入iptables

采集者请求的log样例

122.70.137.104 – – [10/Jun/2010:13:11:05 +0800] “GET /chongqingjob/list_1.html HTTP/1.0” 200 24013 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.93341)” – 122.70.137.104 – – [10/Jun/2010:13:11:05 +0800] “GET /chongqingjob/list_2.html HTTP/1.0” 200 22803 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.97314)” – 122.70.137.104 – – [10/Jun/2010:13:11:05 +0800] “GET /chongqingjob/list_3.html HTTP/1.0” 200 22397 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.99305)” – 122.70.137.104 – – [10/Jun/2010:13:11:05 +0800] “GET /yunnanjob/list_1.html HTTP/1.0” 200 23545 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.2415)” – 122.70.137.104 – – [10/Jun/2010:13:11:05 +0800] “GET /yunnanjob/list_2.html HTTP/1.0” 200 22274 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.96797)” – 122.70.137.104 – – [10/Jun/2010:13:11:06 +0800] “GET /yunnanjob/list_3.html HTTP/1.0” 200 22222 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.33279)” – 122.70.137.104 – – [10/Jun/2010:13:11:06 +0800] “GET /guizhoujob/list_1.html HTTP/1.0” 200 23911 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.34389)” – 122.70.137.104 – – [10/Jun/2010:13:11:06 +0800] “GET /guizhoujob/list_2.html HTTP/1.0” 200 22928 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.4951)” – 122.70.137.104 – – [10/Jun/2010:13:11:06 +0800] “GET /guizhoujob/list_3.html HTTP/1.0” 200 22232 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 2.0.18697)” –

脚本默认配置 1.每3分钟运行一次 2.检查是否清除iptables中的采集ip 2.取出前3分钟排除百度等蜘蛛后的访问日志 3.取出防问量大于60的前三个ip 4.检查是否是可信任ip 5.检查请求favicon.ico的次数是否大于2 6.将采集ip放入iptable

参数说明

#运行log日志位置 V_DEBUGLOG=./kickleech.log #apache或nginx的访问日志 V_LOG=/opt/nginx/logs/blog.c1gstudio.com.log #访问日志临时文件 V_TMPFILE=/opt/nginx/logs/kickleechtmp.log #ip临时存放位置 V_IPTMPFILE=./kickleechip.log #最前几分钟的访问日志 V_TIMELIMIT=3 #请求频率,大于此值才会进行审核 V_THRESHOLD=60 #取多少个ip放入iptables中(按请求次数降序) V_MAXIP=3 #可信任的ip地址 V_SAFEIP=”192.168.0.15 222.147.111.3 222.236.154.162″ #验证字符,如果在${V_TIMELIMI}分钟内请求${V_CODE}少于${V_REQUESTNUM}次将会被认为是采集者 V_CODE=’favicon.ico’ #是否放入iptables中(iptables不作保存,重载或重启会清除之前记录的ip),1=放入,0=仅记录 V_IPTABLES=1 #用于iptables的web访问端口 V_HTTPPORT=80 #清除采集者的时间,当系统为3,12…分会清除采集ip,采集者又可以采了 #需和crontab的时间设定配合,仅仅清空采集相关ip V_IPTABLESFLUSHTIME=”3 12 21 33 42 51″ V_REQUESTNUM=2

V_CODE参数说明 V_CODE=’favicon.ico’ 可以设置成某个css或图片等 这里的配置为favicon.ico,也就是收藏的小图标,浏览器访问时默认会自动请求根目录下此文件,确保存在。 不要设置expires时间,否则日志中不会记录访问请求 以下为nginx设置

location ~(favicon.ico) { #log_not_found off; expires -1; break; }

这样可以在有缓存时也产生个304请求

222.236.154.162 – – [10/Jun/2010:10:50:37 +0800] “GET /favicon.ico HTTP/1.1” 200 3638 “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 ( .NET CLR 3.5.30729)” – 222.236.154.162 – – [10/Jun/2010:10:52:13 +0800] “GET /favicon.ico HTTP/1.1” 304 0 “-” “Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 ( .NET CLR 3.5.30729)” –

kickleech.log日志记录格式

=====Thu Jun 10 13:12:01 CST 2010======== Flush iptables #清空iptables中相关ip 148 122.70.137.104#请求次数和ip Bad guy 122.70.137.104 #审核为采集者 iptables 122.70.137.104 #放入了iptables =====Thu Jun 10 13:15:01 CST 2010======== None IP #没有超过指定请求数 =====Thu Jun 10 13:18:01 CST 2010======== 165 222.236.154.162 155 125.69.85.71 Safe ip 222.236.154.162 #信任的ip That’s ok 125.69.85.71 #审核为不是采集者 =====Thu Jun 10 13:18:03 CST 2010======== 235 202.102.111.124 That’s ok 202.102.111.124 #审核为不是采集者

安装使用 下载脚本并上传到/opt/shell

chmod 0755 /opt/shell/kickleech.sh

以root身份运行

crontab -e

添加自动运行

*/3 * * * * cd /opt/shell && /bin/sh ./kickleech.sh > /dev/null 2>&1

下载脚本 kickleech.zip

Posted in shell, 技术.

Tagged with , .


Godaddy最新0.99刀域名优惠码

godaddy域名优惠码: INDY2010

这个Godaddy优惠码可以用来注册和转移.com, .net, .mobi, .biz, .us, .org, .ca, .co.uk, 和 .in域名 同样,这个Godaddy优惠码只支持信用卡支付

好像还送.info域名一个。

刚刚买了个com域名,加上要交0.18美分的手续费,全价是1.17美分

原文: http://godaddy.mrooo.com/godaddy-new-0-99-coupon-domain.html

2010-6-22 此优惠码已过期

Posted in 其它, 网站建设.

Tagged with , .


Linux 的 Out-of-Memory (OOM) Killer

这个也让咱遇上了。

top – 10:53:30 up 111 days, 16:49, 1 user, load average: 2.68, 2.98, 3.39 Tasks: 131 total, 1 running, 130 sleeping, 0 stopped, 0 zombie Cpu(s): 20.6%us, 8.9%sy, 0.0%ni, 69.7%id, 0.3%wa, 0.0%hi, 0.4%si, 0.0%st Mem: 8168412k total, 7844888k used, 323524k free, 106604k buffers Swap: 2097144k total, 88664k used, 2008480k free, 6534044k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13596 mysql 15 0 2325m 1.0g 4060 S 283.3 13.0 574:16.15 mysqld
1 root 15 0 10348 88 56 S 0.0 0.0 12:35.68 init
2 root RT -5 0 0 0 S 0.0 0.0 0:02.39 migration/0

#cat /var/log/messages |grep ‘May 26 03’ May 26 03:29:35 touareg kernel: Node 1 Normal per-cpu: empty May 26 03:29:35 touareg kernel: Node 1 HighMem per-cpu: empty May 26 03:29:36 touareg kernel: Free pages: 12980kB (0kB HighMem) May 26 03:29:36 touareg kernel: Active:612100 inactive:1406689 dirty:0 writeback:0 unstable:0 free:3245 slab:6346 mapped-file:1004 mapped-anon:2018482 pagetables:6473 May 26 03:29:37 touareg kernel: Node 0 DMA free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:29:38 touareg kernel: lowmem_reserve[]: 0 1242 6040 6040 May 26 03:29:38 touareg kernel: Node 0 DMA32 free:1876kB min:1768kB low:2208kB high:2652kB active:1092684kB inactive:196800kB present:1272420kB pages_scanned:3346160 all_unreclaimable? yes May 26 03:29:39 touareg kernel: lowmem_reserve[]: 0 0 4797 4797 May 26 03:29:39 touareg kernel: Node 0 Normal free:6548kB min:6836kB low:8544kB high:10252kB active:514812kB inactive:4318496kB present:4912640kB pages_scanned:17304011 all_unreclaimable? yes May 26 03:29:40 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:29:41 touareg kernel: Node 0 HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:29:42 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:29:43 touareg kernel: Node 1 DMA free:1736kB min:12kB low:12kB high:16kB active:0kB inactive:0kB present:10696kB pages_scanned:0 all_unreclaimable? yes May 26 03:29:43 touareg kernel: lowmem_reserve[]: 0 2004 2004 2004 May 26 03:29:43 touareg kernel: Node 1 DMA32 free:2820kB min:2856kB low:3568kB high:4284kB active:845864kB inactive:1106756kB present:2052320kB pages_scanned:4059828 all_unreclaimable? yes May 26 03:29:44 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:29:45 touareg kernel: Node 1 Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:29:45 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:29:46 touareg kernel: Node 1 HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:29:46 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:29:47 touareg kernel: Node 0 DMA: empty May 26 03:29:47 touareg kernel: Node 0 DMA32: 314kB 78kB 416kB 132kB 164kB 0128kB 0256kB 1512kB 11024kB 02048kB 04096kB = 1876kB May 26 03:29:47 touareg kernel: Node 0 Normal: 1154kB 38kB 1116kB 832kB 464kB 2128kB 2256kB 1512kB 01024kB 02048kB 14096kB = 6548kB May 26 03:29:48 touareg kernel: Node 0 HighMem: empty May 26 03:29:48 touareg kernel: Node 1 DMA: 24kB 28kB 116kB 532kB 464kB 0128kB 1256kB 0512kB 11024kB 02048kB 04096kB = 1736kB May 26 03:29:48 touareg kernel: Node 1 DMA32: 634kB 78kB 1716kB 232kB 264kB 6128kB 1256kB 0512kB 11024kB 02048kB 04096kB = 2820kB May 26 03:29:49 touareg kernel: Node 1 Normal: empty May 26 03:29:49 touareg kernel: Node 1 HighMem: empty May 26 03:29:50 touareg kernel: 1339 pagecache pages May 26 03:29:50 touareg kernel: Swap cache: add 1051209, delete 1051023, find 5464906/5502739, race 0+41 May 26 03:29:50 touareg kernel: Free swap = 0kB May 26 03:29:51 touareg kernel: Total swap = 2097144kB May 26 03:29:51 touareg kernel: Free swap: 0kB May 26 03:29:51 touareg kernel: 2293760 pages of RAM May 26 03:29:52 touareg kernel: 251657 reserved pages May 26 03:29:52 touareg kernel: 6005 pages shared May 26 03:29:53 touareg kernel: 263 pages swap cached May 26 03:29:54 touareg kernel: Out of memory: Killed process 13285 (mysqld). May 26 03:29:54 touareg kernel: sshd invoked oom-killer: gfp_mask=0x200d2, order=0, oomkilladj=0 May 26 03:29:55 touareg kernel: May 26 03:29:55 touareg kernel: Call Trace: May 26 03:29:56 touareg kernel: [

] out_of_memory+0x8e/0x2f5 May 26 03:29:57 touareg kernel: [ ] __alloc_pages+0x245/0x2ce May 26 03:29:57 touareg kernel: [ ] read_swap_cache_async+0x45/0xd8 May 26 03:29:57 touareg kernel: [ ] wake_bit_function+0x0/0x23 May 26 03:29:58 touareg kernel: [ ] swapin_readahead+0x60/0xd3 May 26 03:29:58 touareg kernel: [ ] __handle_mm_fault+0x9bc/0xe5c May 26 03:29:59 touareg kernel: [ ] do_page_fault+0x4cb/0x830 May 26 03:29:59 touareg kernel: [ ] skb_dequeue+0x48/0x50 May 26 03:30:00 touareg kernel: [ ] unix_release_sock+0x19e/0x1fa May 26 03:30:00 touareg kernel: [ ] dput+0x2c/0x114 May 26 03:30:00 touareg kernel: [ ] error_exit+0x0/0x84 May 26 03:30:01 touareg kernel: May 26 03:30:01 touareg kernel: Mem-info: May 26 03:30:01 touareg kernel: Node 0 DMA per-cpu: empty May 26 03:30:02 touareg kernel: Node 0 DMA32 per-cpu: May 26 03:30:03 touareg kernel: cpu 0 hot: high 186, batch 31 used:89 May 26 03:30:03 touareg kernel: cpu 0 cold: high 62, batch 15 used:57 May 26 03:30:03 touareg kernel: cpu 1 hot: high 186, batch 31 used:0 May 26 03:30:04 touareg kernel: cpu 1 cold: high 62, batch 15 used:0 May 26 03:30:04 touareg kernel: cpu 2 hot: high 186, batch 31 used:180 May 26 03:30:04 touareg kernel: cpu 2 cold: high 62, batch 15 used:61 May 26 03:30:05 touareg kernel: cpu 3 hot: high 186, batch 31 used:0 May 26 03:30:05 touareg kernel: cpu 3 cold: high 62, batch 15 used:29 May 26 03:30:05 touareg kernel: cpu 4 hot: high 186, batch 31 used:155 May 26 03:30:05 touareg kernel: cpu 4 cold: high 62, batch 15 used:48 May 26 03:30:05 touareg kernel: cpu 5 hot: high 186, batch 31 used:0 May 26 03:30:05 touareg kernel: cpu 5 cold: high 62, batch 15 used:14 May 26 03:30:06 touareg kernel: cpu 6 hot: high 186, batch 31 used:98 May 26 03:30:06 touareg kernel: cpu 6 cold: high 62, batch 15 used:54 May 26 03:30:06 touareg kernel: cpu 7 hot: high 186, batch 31 used:0 May 26 03:30:06 touareg kernel: cpu 7 cold: high 62, batch 15 used:2 May 26 03:30:06 touareg kernel: Node 0 Normal per-cpu: May 26 03:30:06 touareg kernel: cpu 0 hot: high 186, batch 31 used:3 May 26 03:30:07 touareg kernel: cpu 0 cold: high 62, batch 15 used:56 May 26 03:30:07 touareg kernel: cpu 1 hot: high 186, batch 31 used:0 May 26 03:30:07 touareg kernel: cpu 1 cold: high 62, batch 15 used:0 May 26 03:30:07 touareg kernel: cpu 2 hot: high 186, batch 31 used:15 May 26 03:30:07 touareg kernel: cpu 2 cold: high 62, batch 15 used:48 May 26 03:30:07 touareg kernel: cpu 3 hot: high 186, batch 31 used:0 May 26 03:30:08 touareg kernel: cpu 3 cold: high 62, batch 15 used:0 May 26 03:30:08 touareg kernel: cpu 4 hot: high 186, batch 31 used:103 May 26 03:30:08 touareg kernel: cpu 4 cold: high 62, batch 15 used:51 May 26 03:30:08 touareg kernel: cpu 5 hot: high 186, batch 31 used:0 May 26 03:30:08 touareg kernel: cpu 5 cold: high 62, batch 15 used:0 May 26 03:30:08 touareg kernel: cpu 6 hot: high 186, batch 31 used:113 May 26 03:30:09 touareg kernel: cpu 6 cold: high 62, batch 15 used:60 May 26 03:30:09 touareg kernel: cpu 7 hot: high 186, batch 31 used:0 May 26 03:30:09 touareg kernel: cpu 7 cold: high 62, batch 15 used:0 May 26 03:30:09 touareg kernel: Node 0 HighMem per-cpu: empty May 26 03:30:09 touareg kernel: Node 1 DMA per-cpu: May 26 03:30:09 touareg kernel: cpu 0 hot: high 0, batch 1 used:0 May 26 03:30:09 touareg kernel: cpu 0 cold: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 1 hot: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 1 cold: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 2 hot: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 2 cold: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 3 hot: high 0, batch 1 used:0 May 26 03:30:10 touareg kernel: cpu 3 cold: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 4 hot: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 4 cold: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 5 hot: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 5 cold: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 6 hot: high 0, batch 1 used:0 May 26 03:30:11 touareg kernel: cpu 6 cold: high 0, batch 1 used:0 May 26 03:30:12 touareg kernel: cpu 7 hot: high 0, batch 1 used:0 May 26 03:30:12 touareg kernel: cpu 7 cold: high 0, batch 1 used:0 May 26 03:30:12 touareg kernel: Node 1 DMA32 per-cpu: May 26 03:30:12 touareg kernel: cpu 0 hot: high 186, batch 31 used:0 May 26 03:30:12 touareg kernel: cpu 0 cold: high 62, batch 15 used:0 May 26 03:30:12 touareg kernel: cpu 1 hot: high 186, batch 31 used:27 May 26 03:30:12 touareg kernel: cpu 1 cold: high 62, batch 15 used:37 May 26 03:30:12 touareg kernel: cpu 2 hot: high 186, batch 31 used:0 May 26 03:30:13 touareg kernel: cpu 2 cold: high 62, batch 15 used:0 May 26 03:30:13 touareg kernel: cpu 3 hot: high 186, batch 31 used:13 May 26 03:30:13 touareg kernel: cpu 3 cold: high 62, batch 15 used:15 May 26 03:30:13 touareg kernel: cpu 4 hot: high 186, batch 31 used:0 May 26 03:30:13 touareg kernel: cpu 4 cold: high 62, batch 15 used:0 May 26 03:30:13 touareg kernel: cpu 5 hot: high 186, batch 31 used:176 May 26 03:30:13 touareg kernel: cpu 5 cold: high 62, batch 15 used:38 May 26 03:30:14 touareg kernel: cpu 6 hot: high 186, batch 31 used:0 May 26 03:30:14 touareg kernel: cpu 6 cold: high 62, batch 15 used:0 May 26 03:30:14 touareg kernel: cpu 7 hot: high 186, batch 31 used:10 May 26 03:30:14 touareg kernel: cpu 7 cold: high 62, batch 15 used:58 May 26 03:30:14 touareg kernel: Node 1 Normal per-cpu: empty May 26 03:30:14 touareg kernel: Node 1 HighMem per-cpu: empty May 26 03:30:15 touareg kernel: Free pages: 12348kB (0kB HighMem) May 26 03:30:15 touareg kernel: Active:1054383 inactive:964358 dirty:0 writeback:0 unstable:0 free:3087 slab:6302 mapped-file:1005 mapped-anon:2018488 pagetables:6477 May 26 03:30:15 touareg kernel: Node 0 DMA free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:30:15 touareg kernel: lowmem_reserve[]: 0 1242 6040 6040 May 26 03:30:15 touareg kernel: Node 0 DMA32 free:1720kB min:1768kB low:2208kB high:2652kB active:699680kB inactive:588284kB present:1272420kB pages_scanned:2814597 all_unreclaimable? yes May 26 03:30:15 touareg kernel: lowmem_reserve[]: 0 0 4797 4797 May 26 03:30:15 touareg kernel: Node 0 Normal free:6116kB min:6836kB low:8544kB high:10252kB active:2214940kB inactive:2618664kB present:4912640kB pages_scanned:16399035 all_unreclaimable? yes May 26 03:30:16 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:30:16 touareg kernel: Node 0 HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:30:16 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:30:16 touareg kernel: Node 1 DMA free:1736kB min:12kB low:12kB high:16kB active:0kB inactive:0kB present:10696kB pages_scanned:0 all_unreclaimable? yes May 26 03:30:16 touareg kernel: lowmem_reserve[]: 0 2004 2004 2004 May 26 03:30:16 touareg kernel: Node 1 DMA32 free:2776kB min:2856kB low:3568kB high:4284kB active:1303380kB inactive:650400kB present:2052320kB pages_scanned:4508965 all_unreclaimable? yes May 26 03:30:16 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:30:17 touareg kernel: Node 1 Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:30:17 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:30:17 touareg kernel: Node 1 HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no May 26 03:30:17 touareg kernel: lowmem_reserve[]: 0 0 0 0 May 26 03:30:17 touareg kernel: Node 0 DMA: empty May 26 03:30:17 touareg kernel: Node 0 DMA32: 0*4kB 5*8kB 3*16kB 1*32kB 1*64kB 0*128kB 0*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB = 1720kB May 26 03:30:17 touareg kernel: Node 0 Normal: 497*4kB 44*8kB 40*16kB 20*32kB 9*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB = 6116kB May 26 03:30:18 touareg kernel: Node 0 HighMem: empty May 26 03:30:18 touareg kernel: Node 1 DMA: 2*4kB 2*8kB 1*16kB 5*32kB 4*64kB 0*128kB 1*256kB 0*512kB 1*1024kB 0*2048kB 0*4096kB = 1736kB May 26 03:30:18 touareg kernel: Node 1 DMA32: 184*4kB 33*8kB 17*16kB 7*32kB 4*64kB 6*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 2776kB May 26 03:30:18 touareg kernel: Node 1 Normal: empty May 26 03:30:18 touareg kernel: Node 1 HighMem: empty May 26 03:30:18 touareg kernel: 1379 pagecache pages May 26 03:30:18 touareg kernel: Swap cache: add 1053289, delete 1053103, find 5465453/5503467, race 0+41 May 26 03:30:18 touareg kernel: Free swap = 0kB May 26 03:30:19 touareg kernel: Total swap = 2097144kB May 26 03:30:19 touareg kernel: Free swap: 0kB May 26 03:30:19 touareg kernel: 2293760 pages of RAM May 26 03:30:19 touareg kernel: 251657 reserved pages May 26 03:30:19 touareg kernel: 5999 pages shared May 26 03:30:19 touareg kernel: 263 pages swap cached May 26 03:30:19 touareg kernel: Out of memory: Killed process 13328 (mysqld). May 26 03:30:19 touareg kernel: mysqld: page allocation failure. order:0, mode:0x201d2 先增加2G swap再说 #dd if=/dev/zero of=/opt/swapfile bs=1M count=2048 #mkswap /opt/swapfile #swapon /opt/swapfile #swapon -s Filename Type Size Used Priority /dev/mapper/VolGroup00-LogVol00 partition 2097144 87352 -1 /opt/swapfile file 2097144 0 -2 在fstab增加相关记录,否则重启就没了 #vi /etc/fstab /opt/swapfile swap swap defaults 0 0 参考 http://www.dbanotes.net/database/linux_outofmemory_oom_killer.html http://jk.scanmon.com/1228.html http://www.itjaj.com/thread-3029-1-1.html

Posted in linux 维护优化, 技术.

Tagged with .


RHCE 顺利通过

The results of your RHCE Certification Exam are reported below. The RHCE Certification Exam allows candidates to qualify for the Red Hat Certified Engineer (RHCE) and Red Hat Certified Technician (RHCT) certificates. Please note that the RHCE designation is understood to both include and supersede the RHCT designation.

RHCE requirements: score of 70 or higher on RHCT components (100 points) score of 70 or higher on RHCE components (100 points)

RHCT requirement: score of 70 or higher on RHCT components (100 points)

RHCT components score: 92.6 RHCE components score: 100.0

RHCE Certification: PASS

Congratulations — you are now certified as a Red Hat Certified Engineer! Your RHCE Certificate number is 80501000xxxxxxx. The attached file is your personal print-ready certificate.

You are entitled to print this document and use it to demonstrate that you are an RHCE, provided you remain an RHCE in good standing. You may not modify or change the document’s contents in any way, nor may you appropriate any elements of this document for use in other electronic documents or printed materials. You may only print the document in its entirety. Any other use of the document must be approved by Red Hat, Inc.

Posted in RHCE&RHCA, 技术.

Tagged with , .


【转】MySql varchar排序,加減 CAST ,CONVERT

假如表结构如下 id(int) a(varchar) 1 1 2 2 3 10 4 20 5 3 6 30

第一种,cast 用法:cast(字段 as 数据类型) [当然是否可以成功转换,还要看数据类型强制转化时注意的问题] 实例:select cast(a as unsigned) as b from cardserver where order by b desc;

第二种,convert 用法:convert(字段,数据类型) 实例:select convert(a ,unsigned) as b from cardserver where order by b desc;

第三种,加減0法 用法:字段加0或减0操作 [在MYSQL中,varchar加减数字就会自动转换为数字操作] 实例:select a+0 as b from cardserver where order by b desc;

参考:http://hi.baidu.com/loglab/blog/item/37606cdd7744523f5982dd35.html

Posted in Mysql, 技术.

Tagged with .


使用Oracle JRockit 提高tomcat性能

http://www.oracle.com/technology/software/products/jrockit/index.html

这里选择Oracle JRockit Real Time 3.1.2 for Java version 6 1 Linux x86-64 大概121M

http://download.oracle.com/otn/bea/jrockit/jrrt-3.1.2-1.6.0-linux-x64.bin

必需要登录后才能下载,wget不好使,用windows下载后再传到服务器上。

chmod u+x jrrt-3.1.2-1.6.0-linux-x64.bin ./jrrt-3.1.2-1.6.0-linux-x64.bin 根据提示一步步安装。 我安装在/usr/jrrt-3.1.2-1.6.0 目录下,做个软连接到/usr/jrrt ln -s /usr/jrrt-3.1.2-1.6.0 /usr/jrrt

修改环境变量,如果之前有设置,只需修改JAVA_HOME到新路径 vi /etc/profile

#set for j2sdk   JAVA_HOME=/usr/jrrt   export JAVA_HOME   CLASSPATH=$JAVA_HOME/jre/lib/ext/jcert.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/jpda.jar:$JAVA_HOME/lib/tools.jar   export CLASSPATH   PATH=.:$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin   export PATH

关闭tomcat source /etc/profile 启动tomcat,完成

参考: http://javaworld.org.ru/java_2344.html

Posted in Tomcat, 技术.

Tagged with , .


Red Hat Certified Engineer (RHCE)

 

Exam Preparation

Courses you should take: Level of Linux Expertise:
None Some Much Expert
Standard Track * Rapid Track **
RH033 Red Hat Linux Essentials yes      
RH131 Red Hat System Administration or RH133 Red Hat Linux Administration (and RHCT Exam) yes yes    
RH253 Red Hat Linux Networking and Security Administration yes yes    
RH300 Red Hat Rapid Track Course (and RHCE Exam)     yes  
RH302 RHCE Exam yes yes   yes

http://www.redhat.com/certification/rhce/

Posted in RHCE&RHCA, 技术.

Tagged with .


The RHCSS, RHCDS & RHCA Exam Prep Guides are now available on the web.

 

RHCSS Prep Guide URLs: https://www.redhat.com/certification/ex333/prep_guide/ https://www.redhat.com/certification/ex423/prep_guide/ https://www.redhat.com/certification/ex429/prep_guide/

RHCDS Prep Guide URLs: https://www.redhat.com/certification/ex401/prep_guide/ https://www.redhat.com/certification/ex423/prep_guide/ https://www.redhat.com/certification/ex436/prep_guide/

RHCA Prep Guide URLs: https://www.redhat.com/certification/ex333/prep_guide/ https://www.redhat.com/certification/ex401/prep_guide/ https://www.redhat.com/certification/ex423/prep_guide/ https://www.redhat.com/certification/ex436/prep_guide/ https://www.redhat.com/certification/ex442/prep_guide/

Course Outline

rh436 https://www.redhat.com/courses/rh436_red_hat_enterprise_clustering_and_s… rh333 https://www.redhat.com/courses/rhs333_red_hat_enterprise_security_networ… rh410 https://www.redhat.com/courses/rh401_red_hat_enterprise_deployment_virtu… rh423 https://www.redhat.com/courses/rh423_red_hat_enterprise_directory_servic… rh442 https://www.redhat.com/courses/rh442_red_hat_enterprise_system_monitorin

Posted in RHCE&RHCA.

Tagged with , , .


TinyMCE中只对部分Textarea起作用

方法一:mode与elements是搭配使用

mode与elements是搭配使用的,用来指定渲染name在elements中的HTML元素为TinyMCE编辑器(可以是DIV或者Textarea),比如: mode : “exact”,elements : “example_textarea” 也可以单独用 mode : “textareas”,这样页面中所有的Textarea元素都会被渲染。

tinyMCE.init({ mode : “exact”, elements : “example_textarea”, });

方法二:选项editor_selector和editor_deselector

这个选项指定一个CSS class 名,当textarea要被转换时需要。它让你通过在属性中增加CSS class 名选择特定的 textareas 转换。如果选项没有被设值,这个选项不会有任何作用。而由 mode 来指定要转换的textarea。如果你想要转换所有的编辑器,而排除特定的编辑器,请查看 editor_deselector 选项。

editor_selector 选项的使用示例:

tinyMCE.init({ … editor_selector : “mceEditor” });

在 HTML 中的使用示例:

选项:editor_deselector

这个选项指定一个 CSS class 名,这样就不会将含有该class名的 textareas 转换成编辑器实例。如果没有设任何值,这个选项没有任何作用。而是由mode 选项来指定要转换的 textarea。 选项的默认值是 “mceNoEditor”,因此如果将 mceNoEditor 加入一个 textarea 的 class 属性中,这个 textarea 则不会被转换。

editor_deselector 选项的使用示例:

tinyMCE.init({ … editor_deselector : “mceNoEditor” });

在 HTML 中的使用示例:

参考: http://www.visame.org/entry/12016/

Posted in JavaScript/DOM/XML, 技术.

Tagged with .


去除/var/log/messages中crond信息

messages含有过多的crond重复信息,影响阅读

tail /var/log/messages

Mar 4 14:18:01 localhost crond(pam_unix)[625]: session opened for user root by (uid=0) Mar 4 14:18:01 localhost crond[626]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1) Mar 4 14:18:01 localhost crond(pam_unix)[625]: session closed for user root Mar 4 14:19:01 localhost crond(pam_unix)[761]: session opened for user root by (uid=0) Mar 4 14:19:01 localhost crond[762]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1) Mar 4 14:19:01 localhost crond(pam_unix)[761]: session closed for user root Mar 4 14:20:01 localhost crond(pam_unix)[1172]: session opened for user root by (uid=0) Mar 4 14:20:01 localhost crond[1174]: (root) CMD (if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi) Mar 4 14:20:01 localhost crond(pam_unix)[1173]: session opened for user root by (uid=0) Mar 4 14:20:01 localhost crond[1175]: (root) CMD (/bin/sh /opt/shell/session_gc.sh > /dev/null 2>&1)

修改syslog.conf,在messages的输出中增加cron.none;auth.none cron和认证信息可以在/var/log/secure和/var/log/cron中查看 vi /etc/syslog.conf

*.info;mail.none;authpriv.none;cron.none;auth.none /var/log/messages

重启服务 /etc/init.d/crond restart

参考: http://www.chinarhcx.com/node/7

Posted in linux 维护优化, 技术.

Tagged with , .