Skip to content


用varnish来加速图片服务器

varnish是和squid类似的高性能开源HTTP加速器,我这里用来缓存图片,js,css等小文件

varnish cache 192.168.0.15 centos6.0 nagios www后端 192.168.0.11 centos5.3

1.安装varnish

wget http://repo.varnish-cache.org/source/varnish-3.0.0.tar.gz tar zxvf varnish-3.0.0.tar.gz cd varnish-3.0.0 ./configure –prefix=/opt/varnish-3.0.0 make make install ln -s /opt/varnish-3.0.0 /opt/varnish

2.设置权限

cd /opt/varnish #varnish以www:website来运行 chown -R www:website /opt/varnish/var/varnish/ mkdir /var/log/varnish chown -R www:website /var/log/varnish chown -R www:website /opt/varnish/var/varnish/`hostname` mkdir /opt/varnish/var/varnish/`hostname`

3.配置文件

#查看默认配置文件 cat etc/varnish/default.vcl

#编辑新配置文件 vi etc/vcl.conf

#http请求处理过程 #1,receive请求入口状态,根据vcl判断pass还是lookup本地查询 #lookup,在hash表中查找数据,若找到则进入hit状态,否则进入fetch状态 #pass,选择后台,进入fetch状态 #fetch,对请求进行后端的获取,发送请求,获得数据,并进行本地存储 #deliver,将数据发送给客户端,进入done #done,处理结束 backend wwwserver { .host = “192.168.0.11”; .port = “80”; } backend staticserver { .host = “192.168.0.11”; .port = “80”; } acl purge { “localhost”; “127.0.0.1”; “192.168.1.0”/24; } sub vcl_recv { if (req.request == “PURGE”) { if (!client.ip ~ purge) { error 405 “Not allowed.”; } return(lookup); } #去除cookie if (req.request == “GET” && req.url ~ “^/[^?]+\.(jpeg|jpg|png|gif|ico|swf|js|css|txt|zip|html|htm)(\?.*|)$”) { unset req.http.Cookie; } #判断req.http.X-Forwarded-For 如果前端有多重反向代理,这样可以获取客户端IP地址。 if (req.http.x-forwarded-for) { set req.http.X-Forwarded-For = req.http.X-Forwarded-For + “, “+ client.ip; } else { set req.http.X-Forwarded-For = client.ip; } #浏览器Accept-Encoding兼容 if (req.http.Accept-Encoding) { if (req.url ~ “\.(jpg|png|gif|jpeg)$”) { remove req.http.Accept-Encoding; } elsif (req.http.Accept-Encoding ~ “gzip”) { set req.http.Accept-Encoding = “gzip”; } elsif (req.http.Accept-Encoding ~ “deflate”) { set req.http.Accept-Encoding = “deflate”; } else { remove req.http.Accept-Encoding; } } if (req.http.host ~ “^blog.c1gstudio.com”) { set req.backend = wwwserver; if (req.request != “GET” && req.request != “HEAD”) { return(pipe); } elseif(req.url ~ “\.(php|cgi)($|\?)”) { return(pass); } else { return(lookup); } } elsif (req.http.host ~ “^static.c1gstudio.net”) { #第二个域名 set req.backend = staticserver; }else { error 404 “Cache Server”; return(lookup); } } sub vcl_hit { if (req.request == “PURGE”) { set obj.ttl = 0s; error 200 “Purged.”; } } sub vcl_miss { if (req.request == “PURGE”) { error 404 “Not in cache.”; } } sub vcl_fetch { if (req.request == “GET” && req.url ~ “\.(jpeg|jpg|png|gif|ico|swf|js|css|txt|zip)$”) { set beresp.ttl = 600s; unset beresp.http.set-cookie; } else { set beresp.ttl = 3600s; } } #显示是否命中 sub vcl_deliver{ if (obj.hits > 0) { set resp.http.X-Cache = “Server-1-HIT”; set resp.http.X-Cache-Hits = obj.hits; } else { set resp.http.X-Cache = “Server-1-MISS”; } unset resp.http.X-Varnish; set resp.http.Via = “1.1 Xcache”; }

4.启动varnish

/opt/varnish/sbin/varnishd -n /opt/varnish/var/varnish -f /opt/varnish/etc/vcl.conf -a 0.0.0.0:80 -s malloc,1G -g website -u www -T 127.0.0.1:3200 -p sess_workspace=64768 -p thread_pools=2 -p listen_depth=4096 -p first_byte_timeout=10 -p sess_timeout=15 -w 200,5000,10

#参数说明

-n vcache / #临时文件实例名.如果以”/”开头,就必须是一个可用的路径. -a :80 / #服务所在端口.”:80″是默认所有网络都建立80端口,”:”前面是服务器IP. -T :5000 / #管理端口. -s file,/data1/vcache,80g / #虚拟内存文件映射类型,路径以及容量. 包括两种类型”malloc”和”file” -s file,/data2/vcache,80g / #malloc是内存+swap交换模式.很简单.没得说. -s file,/data3/vcache,80g / #file是mmap的文件内存映射机制.(具体情况,参阅”mmap”函数说明) -s file,/data4/vcache,80g / -f /usr/local/varnish/etc/varnish.vcl / #VCL文件路径. -P /var/run/varnish.pid / #PID文件地址. -w 200,5000,10 / #工作进程数.三个参数分别是:,, -h classic,16383 / #hash列表类型,以及长度.默认长度是16383.具体用处和调整实际效果要等我看完源代码才知道. -p user=www / #”-p”是变量配置参数 -p group=website/ #服务运行用户和用户组配置. -p thread_pools=4 / #进程connections pools的个数,数量越多,越耗用cpu和mem,但是处理并发能力越强. #系统手册上说,一个cpu用一个. -p listen_depth=4096 / #TCP队列长度.默认是1024. -p first_byte_timeout=10 #从后端接受第一个字节的超时时间。默认60秒 -p between_bytes_timeout=60 #从后端接收数据后,连接空闲时间,默认60秒 -p sess_timeout=15 #客户端和varnish连接超时时间,默认5秒

===============2015-1-16更新===============

4.2不关闭varnish,重新载入配置

telnet 127.0.0.1 3200 使用命令 vcl.load new.vcl /opt/varnish/etc/vcl.conf (编译出错的话会有提示,成功会返回200) 200 然后使用 vcl.use new.vcl (成功后同样会返回200) 200

crtl+] quit

5.记录日志 /opt/varnish/bin/varnishncsa -n /opt/varnish/var/varnish -w /var/log/varnish/varnish.log &

#定时切割日志 vi /opt/shell/cutvarnishlog.sh

#!/bin/sh # 0 0 * * * /bin/sh /opt/shell/cutvarnishlog.sh > /dev/null 2>&1 date=$(date -d “yesterday” +”%Y%m%d”) pkill -9 varnishncsa mv /var/log/varnish/varnish.log /var/log/varnish/varnish.${date}.log /opt/varnish/bin/varnishncsa -n /opt/varnish/var/varnish -w /var/log/varnish/varnish.log & mkdir -p /var/log/varnish/old gzip -c /var/log/varnish/varnish.${date}.log > /var/log/varnish/old/varnish.${date}.log.gz rm -f /var/log/varnish/varnish.${date}.log rm -f /var/log/varnish/old/varnish$(date -d “-1 month” +”%Y%m*”).log.gz

crontab -e

0 0 * * * /bin/sh /opt/shell/cutvarnishlog.sh > /dev/null 2>&1

6.查看运行统计 /opt/varnish/bin/varnishstat -n /opt/varnish/var/varnish

1+01:13:37 /opt/varnish/var/varnish Hitrate ratio: 10 100 288 Hitrate avg: 0.9987 0.9981 0.9978 22251295 371.40 245.01 client_conn – Client connections accepted 22250487 371.40 245.00 client_req – Client requests received 22185321 371.40 244.29 cache_hit – Cache hits 62904 0.00 0.69 cache_miss – Cache misses 4615 0.00 0.05 backend_conn – Backend conn. success 22 0.00 0.00 backend_fail – Backend conn. failures 59164 0.00 0.65 backend_reuse – Backend conn. reuses 456 0.00 0.01 backend_toolate – Backend conn. was closed 59622 0.00 0.66 backend_recycle – Backend conn. recycles 47470 0.00 0.52 fetch_length – Fetch with Length 16307 0.00 0.18 fetch_chunked – Fetch chunked 2 0.00 0.00 fetch_close – Fetch wanted close 1873 . . n_sess_mem – N struct sess_mem 1834 . . n_sess – N struct sess 655 . . n_object – N struct object 685 . . n_objectcore – N struct objectcore 784 . . n_objecthead – N struct objecthead 405 . . n_waitinglist – N struct waitinglist 2 . . n_vbc – N struct vbc 31 . . n_wrk – N worker threads 381 0.00 0.00 n_wrk_create – N worker threads created 2584 0.00 0.03 n_wrk_queued – N queued work requests 2 . . n_backend – N backends 62227 . . n_expired – N expired objects 5365503 . . n_lru_moved – N LRU moved objects 1362 0.00 0.01 losthdr – HTTP header overflows 18551363 326.47 204.27 n_objwrite – Objects sent with write 22251295 371.40 245.01 s_sess – Total Sessions 22250487 371.40 245.00 s_req – Total Requests 898 0.00 0.01 s_pass – Total pass 63779 0.00 0.70 s_fetch – Total fetch 7539848276 127352.96 83022.43 s_hdrbytes – Total header bytes 141933911830 2248780.45 1562856.20 s_bodybytes – Total body bytes 22251292 371.40 245.01 sess_closed – Session Closed 1 0.00 0.00 sess_herd – Session herd 998035729 16610.26 10989.53 shm_records – SHM records 89193699 1488.60 982.13 shm_writes – SHM writes 328009 8.99 3.61 shm_cont – SHM MTX contention 385 0.00 0.00 shm_cycles – SHM cycles through buffer 1387 0.00 0.02 sms_nreq – SMS allocator requests

7.管理清除缓存 7.1通过Varnish管理端口进行管理 /opt/varnish/bin/varnishadm -T 127.0.0.1:3200 help

CLI connected to 127.0.0.1:3200 help [command] ping [timestamp] auth response quit banner status start stop vcl.load vcl.inline vcl.use vcl.discard vcl.list vcl.show param.show [-l] [ ] param.set panic.show panic.clear storage.list ban.url ban [&& ]… ban.list

通过Varnish管理端口清除缓存,支持正则表达式,1.0时为url.purge参数: /opt/varnish/bin/varnishadm -T 127.0.0.1:3200 ban.url /shanghai-4.html

例:清除所有缓存: /opt/varnish/bin/varnishadm -T 127.0.0.1:3200 ban.url *$

7.2通过telnet方式清除

telnet 127.0.0.1 3200 Trying 127.0.0.1 … Connected to 127.0.0.1. Escape character is ‘^]’. 200 205 —————————– Varnish Cache CLI 1.0 —————————– Linux,2.6.32-71.el6.i686,i686,-smalloc,-smalloc,-hcritbit Type ‘help’ for command list. Type ‘quit’ to close CLI session. help 200 401 help [command] ping [timestamp] auth response quit banner status start stop vcl.load vcl.inline vcl.use vcl.discard vcl.list vcl.show param.show [-l] [ ] param.set panic.show panic.clear storage.list ban.url ban [&& ]… ban.list #1.0时的方法现在不支持 purge.url /shanghai-4.html 200 0 101 44 Unknown request. Type ‘help’ for more info. #正确方法 ban.url /shanghai-4.html 200 0

7.3通过php等其它web请求清除缓存

function purge($ip,$port=80,$domain, $url) { $errstr = ”; $errno = ”; $fp = fsockopen ($ip, $port, $errno, $errstr, 2); if (!$fp) { return false; } else { $out = “PURGE $url HTTP/1.1\r\n”; $out .= “Host:$domain\r\n”; $out .= “Connection: close\r\n\r\n”; fputs ($fp, $out); $out = fgets($fp , 4096); fclose ($fp); return true; } } purge(‘192.168.0.15′,’80’,’blog.c1gstudio.com’,’/shanghai-4.html’);

8.varnish的nginx前端 测试下来nginx和varnish在同一机器上会产生大量time_wait,单独使用没有问题.

upstream mysvr { server 127.0.0.1:82; } server { listen 80; server_name static.c1gstudio.net; index index.html index.htm index.php; root /opt/lampp/htdocs/web; location ~/\.ht { deny all; } location ~(favicon.ico) { log_not_found off; expires 99d; break; } location ~ .*\.(php|html|htm)?$ { return 403; } location / { valid_referers none blocked *.c1gstudio.com *.c1gstudio.net ; if ($invalid_referer) { rewrite ^/ http://leech.c1gstudio.com/leech.gif; return 412; break; } proxy_pass http://mysvr; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } access_log /var/log/nginx/static.c1gstudio.net.log access; }

9.内核优化 vi /etc/sysctl.conf

net.ipv4.tcp_fin_timeout = 30 net.ipv4.tcp_keepalive_time = 300 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_tw_recycle = 1 net.ipv4.ip_local_port_range = 5000 65000

sysctl -p

varnish服务器运行基本没有负载

top – 15:54:34 up 34 days, 23:49, 1 user, load average: 0.00, 0.01, 0.00 Tasks: 125 total, 1 running, 124 sleeping, 0 stopped, 0 zombie Cpu(s): 1.8%us, 1.3%sy, 0.0%ni, 95.0%id, 0.4%wa, 0.0%hi, 1.5%si, 0.0%st Mem: 2070548k total, 2017996k used, 52552k free, 83556k buffers Swap: 2097144k total, 0k used, 2097144k free, 1612756k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 26631 www 20 0 228m 134m 81m S 7.6 6.7 74:46.86 varnishd 6070 www 20 0 31852 25m 1000 S 3.3 1.3 7:28.79 nginx 6071 www 20 0 31076 24m 1000 S 2.0 1.2 7:22.34 nginx 6068 www 20 0 31356 25m 976 S 1.7 1.3 7:21.36 nginx

tcp状态 netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’

LAST_ACK 9 SYN_RECV 5 CLOSE_WAIT 3 ESTABLISHED 2083 FIN_WAIT1 95 FIN_WAIT2 247 TIME_WAIT 14412

2011-11-17更新 2011-11-15更新

参考: Varnish-2.1.2 安装与配置.pdf varnish浅析.pdf varnish文件缓存实现2008-11-22.pdf 三个文件包下载varnishdocs 736k

http://blog.s135.com/post/313/ http://eneplace.com/2011/01/varnish-cookies-querystrings.html https://www.varnish-cache.org/docs/3.0/reference/vcl.html#variables

Posted in Squid/varnish.

Tagged with , .


流氓电信DNS劫持强插广告

论坛 BBS 论坛 –

论坛右下角偶尔刷新会出现广告弹窗,整个论坛被包含在一个IFRAME里, 本以为是被挂马,搜了下这个111.175.242.23 IP是湖北省武汉市电信,网上很多论坛也遭殃了.

Posted in 安全.

Tagged with , .


修改numa和io调度优化mysql性能

一.NUMA设置 单机单实例,建议关闭NUMA,关闭的方法有三种: 1.硬件层,在BIOS中设置关闭; 2.OS内核,启动时设置numa=off; 3.可以用numactl命令将内存分配策略修改为interleave(交叉)

方法3 修改mysql.server 330行加上numactl vi /opt/mysql/bin/mysql.server

/usr/bin/numactl –interleave all $bindir/mysqld_safe –datadir=$datadir –pid-file=$server_pid_file $other_args >/dev/null 2>&1 & wait_for_pid created $!; return_value=$?

numastat 查看内存分配

node0 node1 numa_hit 56506002860 201877592362 numa_miss 9099468163 1450668930 numa_foreign 1450668930 9099468163 interleave_hit 6205106 4793392 local_node 56485823400 201848609519 other_node 9119647623 1479651773

二.IO调度算法 Linux有四种IO调度算法:CFQ,Deadline,Anticipatory和NOOP,CFQ是默认的IO调度算法。完全随机的访问环境下,CFQ与Deadline,NOOP性能差异很小,但是一旦有大的连续IO,CFQ可能会造成小IO的响应延时增加,所以数据库环境建议修改为deadline算法,表现更稳定。 IO调度算法都是基于磁盘设计,所以减少磁头移动是最重要的考虑因素之一,但是使用Flash存储设备之后,不再需要考虑磁头移动的问题,可以使用NOOP算法。NOOP的含义就是NonOperation,意味着不会做任何的IO优化,完全按照请求来FIFO的方式来处理IO。

IO调度,默认cfq echo ‘deadline’ > /sys/block/sdb/queue/scheduler cat /sys/block/sdb/queue/scheduler

noop anticipatory [deadline] cfq

减少预读,默认128 echo ’16’ > /sys/block/sda/queue/read_ahead_kb

增大队列,默认128 echo ‘512’ > /sys/block/sda/queue/nr_requests

尽量不使用交换区,默认60 echo ‘0’ > /proc/sys/vm/swappiness

开机运行 vi /etc/rc.local

echo ‘deadline’ > /sys/block/sdb/queue/scheduler echo ’16’ > /sys/block/sda/queue/read_ahead_kb echo ‘512’ > /sys/block/sda/queue/nr_requests

vi /etc/sysctl.conf

vm.swappiness=0

参考: http://blog.wl0.org/2011/03/how-to-start-mysqld-using-numactl/ http://jcole.us/blog/archives/2010/09/28/mysql-swap-insanity-and-the-numa-architecture/ http://linuxcommand.org/man_pages/numactl8.html http://software.intel.com/zh-cn/blogs/2008/11/24/numaxeon1/ http://www.mysqlops.com/2011/07/01/mysql_multi_using_numactl.html https://wickie.hlrs.de/platforms/index.php/Thread_And_Memory_Pinning http://www.cyberciti.biz/tips/linux-hugetlbfs-and-mysql-performance.html http://www.hellodb.net/2011/07/mysql-linux-hardware-tuning.html http://blog.csdn.net/liuben/article/details/5482167 http://hatemysql.com/2011/07/05/mysql%E6%9C%BA%E5%99%A8%E9%85%8D%E7%BD%AE%E6%A0%87%E5%87%86/

Posted in Mysql.

Tagged with , , , .


discuzX2 读写分离及配置mysql复制

之前配置了fastcgi双机负载均衡discuzx2,现在做读写分离

主服务器ip:192.168.0.17 从服务器ip:192.168.0.23

1.主服务器设置 确保在服务器和从服务器上安装的MySQL版本与6.5节,“不同MySQL版本之间的复制兼容性”所示的表兼容。理想情况,应在主服务器和从服务器上使用最近版本的MySQL。 在主服务器上为服务器设置一个连接账户。该账户必须授予REPLICATION SLAVE权限。如果账户仅用于复制(推荐这样做),则不需要再授予任何其它权限。 假定你的从服务器ip为192.168.0.23,想要创建用户名为repl的一个账户,从服务器可以使用该账户从你的域内的任何主机使用密码slavepass来访问主服务器。要创建该账户,可使用GRANT语句:

GRANT REPLICATION SLAVE ON *.* TO ‘repl’@’192.168.0.23’ IDENTIFIED BY ‘slavepass’;

更新权限

flush privileges;

确保主服务器主机上my.cnf文件的[mysqld]部分包括一个log-bin选项。该部分还应有一个server-id=Master_id选项,其中master_id必须为1到232–1之间的一个正整数值。例如:

log-bin=/opt/mysql/var_log/mysql-bin expire_logs_days = 10 server-id=1 binlog-do-db=discuzx log-slave-updates

2.从服务器设置 停止用于从服务器的服务器并在其my.cnf文件中添加下面的行: slave_id值同Master_id值一样,必须为1到232–1之间的一个正整数值。并且,从服务器的ID必须与主服务器的ID不相同。例如:

[mysqld] server-id=2 replicate-do-db=discuzx replicate-ignore-table=discuzx.pre_common_session slave-net-timeout=60 master-connect-retry=10 slave-skip-errors #concurrent_insert=2 low-priority-updates=1 max_write_lock_count=1 master-host=192.168.0.17 master-port=3306 master-user=repl master-password=slavepass

3.在主服务器上先锁表,禁止写入操作

FLUSH TABLES WITH READ LOCK;

备份数据库

cd /opt/mysql/ tar -cvf ./mysql-snapshot.tar ./var/discuzx

4.从服务器解压

scp -P 6022 ./mysql-snapshot.tar [email protected]:. tar -xvf ./mysql-snapshot.tar mv ./var/discuzx /opt/mysql/var/

5.设置同步 进入master上的mysql,查看master状态

SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB mysql-bin.000001 6416812 discuzx File列显示日志名,而Position显示偏移量。在该例子中,二进制日志值为mysql-bin.000001,偏移量为6416812。记录该值。以后设置从服务器时需要使用这些值。它们表示复制坐标,从服务器应从该点开始从主服务器上进行新的更新。 取得快照并记录日志名和偏移量后,可以在主服务器上重新启用写活动: 在从服务器上执行下面的语句,用你的系统的实际值替换选项值: CHANGE MASTER TO MASTER_HOST=’192.168.0.17′, MASTER_USER=’repl’, MASTER_PASSWORD=’slavepass’, MASTER_LOG_FILE=’mysql-bin.000001′, MASTER_LOG_POS=6416812; 启动从服务器线程并查看状态: START SLAVE; show slave status; //Slave_IO_Running 与 Slave_SQL_Running 状态都要为Yes //Seconds_Behind_Master为主服务器同频延迟 查看进程 show processlist; //应该有两行state值为: Has read all relay log; waiting for the slave I/O thread to update it Waiting for master to send event 复制从I/O线程状态 下面列出了从服务器的I/O线程的State列的最常见的状态。该状态也出现在Slave_IO_State列,由SHOW SLAVE STATUS显示。这说明你可以只通过该语句仔细浏览所发生的事情。 · Connecting to master 线程正试图连接主服务器。 · Checking master version 建立同主服务器之间的连接后立即临时出现的状态。 · Registering slave on master 建立同主服务器之间的连接后立即临时出现的状态。 · Requesting binlog dump 建立同主服务器之间的连接后立即临时出现的状态。线程向主服务器发送一条请求,索取从请求的二进制日志文件名和位置开始的二进制日志的内容。 · Waiting to reconnect after a failed binlog dump request 如果二进制日志转储请求失败(由于没有连接),线程进入睡眠状态,然后定期尝试重新连接。可以使用–master-connect-retry选项指定重试之间的间隔。 · Reconnecting after a failed binlog dump request 线程正尝试重新连接主服务器。 · Waiting for master to send event 线程已经连接上主服务器,正等待二进制日志事件到达。如果主服务器正空闲,会持续较长的时间。如果等待持续slave_read_timeout秒,则发生超时。此时,线程认为连接被中断并企图重新连接。 · Queueing master event to the relay log 线程已经读取一个事件,正将它复制到中继日志供SQL线程来处理。 · Waiting to reconnect after a failed master event read 读取时(由于没有连接)出现错误。线程企图重新连接前将睡眠master-connect-retry秒。 · Reconnecting after a failed master event read 线程正尝试重新连接主服务器。当连接重新建立后,状态变为Waiting for master to send event。 · Waiting for the slave SQL thread to free enough relay log space 正使用一个非零relay_log_space_limit值,中继日志已经增长到其组合大小超过该值。I/O线程正等待直到SQL线程处理中继日志内容并删除部分中继日志文件来释放足够的空间。 · Waiting for slave mutex on exit 线程停止时发生的一个很简单的状态。 复制从SQL线程状态 下面列出了从服务器的SQL线程的State列的最常见的状态。 · Reading event from the relay log 线程已经从中继日志读取一个事件,可以对事件进行处理了。 · Has read all relay log; waiting for the slave I/O thread to update it 线程已经处理了中继日志文件中的所有事件,现在正等待I/O线程将新事件写入中继日志。 · Waiting for slave mutex on exit 线程停止时发生的一个很简单的状态。 I/O线程的State列也可以显示语句的文本。这说明线程已经从中继日志读取了一个事件,从中提取了语句,并且正在执行语句。 最后将master上的表解锁 UNLOCK TABLES; 在主服务器上,SHOW PROCESSLIST的输出看上去应为: SHOW PROCESSLIST\G; //state状态应该为Has sent all binlog to slave; waiting for binlog to be updated 复制主线程状态 下面列出了主服务器的Binlog Dump线程的State列的最常见的状态。如果你没有在主服务器上看见任何Binlog Dump线程,这说明复制没有在运行—即,目前没有连接任何从服务器。 · Sending binlog event to slave 二进制日志由各种事件组成,一个事件通常为一个更新加一些其它信息。线程已经从二进制日志读取了一个事件并且正将它发送到从服务器。 · Finished reading one binlog; switching to next binlog 线程已经读完二进制日志文件并且正打开下一个要发送到从服务器的日志文件。 · Has sent all binlog to slave; waiting for binlog to be updated 线程已经从二进制日志读取所有主要的更新并已经发送到了从服务器。线程现在正空闲,等待由主服务器上新的更新导致的出现在二进制日志中的新事件。 · Waiting to finalize termination 线程停止时发生的一个很简单的状态。 6.从服务器添加discuzx用户 在从服务器增加c1g_formaster用户访问从服务器权限 7.设置discuzx读写分离 vi bbs/config/config_global.php $_config[‘db’][‘common’][‘slave_except_table’] = ‘common_session’; #不读从服务器的common_session表 $_config[‘db’][‘slave’] = array(); $_config[‘db’][‘slave’][‘1’][‘dbhost’] = ‘192.168.0.23’; //mysql 从库的host $_config[‘db’][‘slave’][‘1’][‘dbuser’] = ‘c1g_formaster’; //mysql 从库的数据库用户名 $_config[‘db’][‘slave’][‘1’][‘dbpw’] = ‘password’; //mysql 从库的数据库密码 $_config[‘db’][‘slave’][‘1’][‘dbcharset’] = ‘gbk’; $_config[‘db’][‘slave’][‘1’][‘pconnect’] = ‘0’; $_config[‘db’][‘slave’][‘1’][‘dbname’] = ‘discuzx’; //mysql从库的数据库名 $_config[‘db’][‘slave’][‘1’][‘tablepre’] = ‘pre_’; 8.运行效果 内网同步大概会占三四十兆流量; 可能由于我的从服务器还跑着php,负载比较大; 从库运行半天后在更新时会死锁,反而影响了论坛正常运行,还是切回单机; ==============2011-12-06 更新 清除slave设置 在sql里运行 stop slave; reset slave; #这将清除 master.info,relay-log.info 关闭mysql,移险日志 cd /opt/mysql/var/ mv hostname-relay-bin.000609 hostname-relay-bin.000609.bak mv hostname-relay-bin.index hostname-relay-bin.index.bak 重启mysql ==================== 2011-12-19 更新 修改主服务器expire_logs_days位置放到log-bin下面 expire_logs_days = 10 参考: http://www.discuz.net/thread-2348271-1-1.html http://liuyu.blog.51cto.com/183345/d-4 http://dev.mysql.com/doc/refman/5.1/zh/replication.html http://blog.lxneng.com/?cat=7

Posted in Discuz/Uchome/Ucenter, Mysql.

Tagged with , , .


inotify+rsync+nginx+fastcgi双机负载均衡discuzx2

一.概述

服务器 web1 R410 E55202 16G SAS300G2 centos5.5 ip:192.168.1.21 web2(new) R410 E56062 16G SAS300G2 centos5.5 ip:192.168.1.23 db R410 E55042 16G SAS146G2 centos5.3

discuz论坛现有500多万贴子,近2万人在线,400万pv/日, 新增web2服务器分担论坛php处理. 尝试过在web2用nfs mount web1的程序来跑,但是访问速度太慢,无法接受 改用inotify+rsync效果不错,原来web1负载8左右,现两台各自3.5

web2安装

web2安装好php后配置php-fpm

192.168.1.23:9002 #监听地址及端口 rsyncuser#后面rsync同步的用户 website#同步用户的用户组 128#目前开128个 大概占用物理内存4G左右 192.168.1.21,192.168.1.23 #充许请求的服务器(web1,web2自已)

web2打开iptables端口

iptables -A INPUT -p tcp -m tcp -s 192.168.1.21 –dport 9002 -j ACCEPT /etc/init.d/iptables save

db服务器加权限 给web2加上和web1一样的用户访问权限(discuz,ucenter…)

web1安装设置

web1安装inotify https://github.com/rvoicilas/inotify-tools/wiki/ inotify-tools 3.14 is the latest version, released on the 7th of March 2010.

wget –no-check-certificate http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz tar zxvf inotify-tools-3.14.tar.gz cd inotify-tools-3.14 make make install 完成后,注意查看manpage,man inotify、man inotifywait

查看是否支持inotify 从kernel 2.6.13开始正式并入内核,RHEL5已经支持。 看看是否有 /proc/sys/fs/inotify/目录,以确定内核是否支持inotify ll /proc/sys/fs/inotify

total 0 -rw-r–r– 1 root root 0 Sep 14 14:01 max_queued_events -rw-r–r– 1 root root 0 Sep 14 14:01 max_user_instances -rw-r–r– 1 root root 0 Sep 14 14:01 max_user_watches

测试inotify /usr/local/bin/inotifywait -mrq –timefmt ‘%d/%m/%y %H:%M’ –format ‘%T %w%f’ -e modify,delete,create,attrib /opt/lampp/htdocs/bbs

16/09/11 15:59 /opt/lampp/htdocs/bbs/data/cache/forum_threadviews_1.log 16/09/11 15:59 /opt/lampp/htdocs/bbs/data/cache/forum_threadviews_1.log 16/09/11 15:59 /opt/lampp/htdocs/bbs/data/cache/forum_threadviews_1.log ….

rsync同步 方法一:使用ssh用户免登录 方法二:使用rsync认证免登录

我这里使用方法一

web2增加同步用户 useradd -g website rsyncuser passwd rsyncuser

web1创建公钥并传到web2 ssh-keygen -t rsa

Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is:

复制到web2

scp -P 22 ~/.ssh/id_rsa.pub [email protected]:.

web2设置免登录 将id_rsa.pub导入到.ssh/authorized_keys

cd /home/rsyncuser mkdir .ssh cat id_rsa.pub >> .ssh/authorized_keys chown -R rsyncuser:website .ssh rm id_rsa.pub

可以在web1测试下登录 ssh -p 22 [email protected]

同步脚本 inofity 的exclude支持posix正则,但只能写一个. 注意两边放bbs的路径要一样 可以先用rsync同步一下

vi inotify.sh

#!/bin/sh yesterday=`date +%Y%m%d` src=/opt/lampp/htdocs/bbs [email protected]:/opt/lampp/htdocs/ /usr/local/bin/inotifywait -mrq –exclude “data/(threadcache|log|template|sendmail\.lock|cache)” –timefmt ‘%d/%m/%y %H:%M’ –format ‘%T %w%f’ \ -e modify,delete,create,attrib ${src} | while read file do echo -e $(date +%Y-%m-%d_%H:%M:%S)”\r” >>rsynclog/inotify.${yesterday}.log rsync -av –delete –exclude “data/threadcache/” –exclude “data/log/” –exclude “data/template/” –exclude “data/sendmail.lock” ${src} -e “/usr/bin/ssh -p 22” ${des} >>rsynclog/inotify.${yesterday}.log done

在web2上创建不同步的目录和文件 cd /opt/lampp/htdocs/bbs mkdir data/{threadcache,log,template} chown -R rsyncuser:website data/{threadcache,log,template} chmod -R 0775 data/{threadcache,log,template} touch data/sendmail.lock chown -R rsyncuser:website data/sendmail.lock chmod -R 0775 data/sendmail.lock

设置权限并运行 chmod 700 ./inofity.sh ./inofity.sh &

加到开机运行

echo ‘cd /opt/shell && ./inofity.sh & ‘>>/etc/rc.local

cache目录的更新 如果使用memcache可以跳过此步 使用文件缓存时 /opt/lampp/htdocs/bbs/data/cache 目录有新注册会员及在线人数等cache,更新很频繁不适于放入inotify中 vi rsync.sh

#!/bin/sh #* * * * * cd /opt/shell && /bin/sh ./rsync.sh > /dev/null 2>&1 yesterday=`date +%Y%m%d` src=/opt/lampp/htdocs/bbs/data/cache [email protected]:/opt/lampp/htdocs/bbs/data/ echo -e $(date +%Y-%m-%d_%H:%M:%S)”\r” >>rsynclog/rsync.${yesterday}.log rsync -av –delete ${src} -e “/usr/bin/ssh -p 22” ${des2} >>rsynclog/rsync.${yesterday}.log

设置权限 chmod 775 ./rsync.sh

crontab -e 加入crontab中 每分钟运行

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

第一次同步完后,开启php /opt/php/sbin/php-fpm start

web1开启负载均衡

web1上调整nginx 先创建个test.php来测试,可以在phpinfo里看到不同的机器名或通firebug查看文件header来确定是否在web2上

echo ‘‘ > test.php

vi /opt/nginx/conf/nginx.conf

location ~ /test\.php?$ { #fastcgi_pass 127.0.0.1:9000; fastcgi_pass 192.168.1.23:9002; add_header App-Server php2; fastcgi_index index.php; include fcgi.conf; break; }

正式上线只需针对forum.php进行负载均衡,90%的负载都在这文件上(只开启论坛情况下)

upstream backend { ip_hash; #确保分流内网能访问公网,或无对外访问需求 server 192.168.1.23:9002 max_fails=3 fail_timeout=60s; server 127.0.0.1:9000; } location ~ /forum\.php?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; #fastcgi_pass 127.0.0.1:9000; #fastcgi_pass 192.168.1.23:9002; #add_header App-Server php2; fastcgi_pass backend; fastcgi_index index.php; include fcgi.conf; break; }

fcgi.conf

fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with –enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200;

重启nginx reload nginx /bin/kill -HUP cat /dev/shm/nginx.pid

discuz上传附件,后台固定在web1,读贴等操作会依据用户ip分布在两台机器上.

参考: http://www.infoq.com/cn/articles/inotify-linux-file-system-event-monitoring http://hi.baidu.com/tonyty163/blog/item/3c14ca2698672a0a918f9daf.html

Posted in Discuz/Uchome/Ucenter, 网站架构.

Tagged with , , , , , .


ACPI引起linux系统无故重启

新装机器无故重启多次。 centos6 64bit uname -a Linux Eos 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux

硬件为Dell R410 E56062 4G1 sas300G *2

系统负载基本为0,查看日志有acpi错误。 tail -n1000 /var/log/messages |grep -i error

Sep 11 10:25:25 C1gstudio kernel: ACPI Error: No handler for Region [IPMI] (ffff88012b6b7420) [IPMI] (20090903/evregion-319) Sep 11 10:25:25 C1gstudio kernel: ACPI Error: Region IPMI(7) has no handler (20090903/exfldio-295) Sep 11 10:25:25 C1gstudio kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._GHL] (Node ffff88012b6b6470), AE_NOT_EXIST Sep 11 10:25:25 C1gstudio kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._PMC] (Node ffff88012b6b64f0), AE_NOT_EXIST Sep 11 10:25:28 C1gstudio abrtd: dbus error: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory Sep 11 10:25:28 C1gstudio abrtd: Error requesting DBus name com.redhat.abrt, possible reasons: abrt run by non-root; dbus config is incorrect; or dbus daemon needs to be restarted to reload dbus config Sep 11 10:35:51 C1gstudio kernel: ACPI Error: No handler for Region [IPMI] (ffff88012b6b7420) [IPMI] (20090903/evregion-319) Sep 11 10:35:51 C1gstudio kernel: ACPI Error: Region IPMI(7) has no handler (20090903/exfldio-295) Sep 11 10:35:51 C1gstudio kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._GHL] (Node ffff88012b6b6470), AE_NOT_EXIST Sep 11 10:35:51 C1gstudio kernel: ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PMI0._PMC] (Node ffff88012b6b64f0), AE_NOT_EXIST Sep 11 10:35:53 C1gstudio abrtd: dbus error: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory Sep 11 10:35:53 C1gstudio abrtd: Error requesting DBus name com.redhat.abrt, possible reasons: abrt run by non-root; dbus config is incorrect; or dbus daemon needs to be restarted to reload dbus config

vi /boot/grub/grub.conf 在kernel一行最后加上acpi=off noacip

kernel … acpi=off noacip

然后重启

Posted in LINUX, 技术.

Tagged with , , .


php5.2.14中strtotime格式时间戳错误引起日期混乱

状况是用smarty version 2.6.5-dev格式的时间在线上服务器显示时间不对.

{$smarty.now|date_format:”%Y/%m/%d %H:%M”}

会显示成 5068/08/16 10:30

检查smarty/plugins/shared.make_timestamp.php strtotime函数在不同版本下会有不同返回结果

$time = strtotime($string);

编写代码确认 code:

echo time(); echo ‘—‘; var_dump(strtotime(time())); ?>

win php5.3.1 result: 1313465002—bool(false)

linux php5.2.14 result: 1313465026—int(96457670026)

“96457670026”?这个就是引起错误的原因.

修改下smarty/plugins/shared.make_timestamp.php 解决问题

if (is_numeric($string) && $string != -1) return $string; $time = strtotime($string); if (is_numeric($time) && $time != -1) return $time;

Posted in PHP.

Tagged with , , , .


更新个php验证email正则

网上随处可见的验证规则会漏掉用户名中常见字符”.”,”-“,”_”; 以及后缀中可能是二级或三级域名的情况.

‘ ‘+’ 和 ‘?’的规则 ‘‘ 匹配0或多次 ‘+’ 匹配1或多次 ‘?’ 匹配0或1次

下面函数的验证规则为: 必需有一个不以”.”开头的字符后接0到多个字符 接上@须有一个字符开头接上0到多个包含”.”的子域名 最后接上”.”开头2到4个字符的域名后缀

function validEmail($address) { if(!preg_match(“/^[0-9a-zA-Z_-]+(\.[0-9a-zA-Z_-]+)*@[a-zA-Z0-9_-]+(\.{1}[a-zA-Z0-9_-]+)*\.{1}[a-zA-Z]{2,4}$/i”,$address)) { return False; } return True; }

Posted in PHP.

Tagged with , , .


Dell R410 网卡在Centos5.5 上丢包

现象是每几十次访问网页就会一次打不开,数据库,临控等才时常取不到数据. 好像r410的网卡和centos5.5不怎么兼容

uname -a

Linux c1gserver 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

dmesg |grep bnx

Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v1.9.3 (March 17, 2009) bnx2: eth0: using MSIX bnx2: eth0 NIC Copper Link is Up, 100 Mbps full duplex

ifconfig 有大量的丢包;dropped:6620400

eth0 Link encap:Ethernet HWaddr 00:26:B9:3B:XX:C3 inet addr:61.255.xx.xx Bcast:61.255.xx.xx Mask:255.255.255.192 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:7330597243 errors:1 dropped:6620400 overruns:0 frame:1 TX packets:8116489614 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3435468718053 (3.1 TiB) TX bytes:3656517601592 (3.3 TiB) Interrupt:82 Memory:da000000-da012800

一.先尝试增加网卡缓存来解决问题 1.ethtool -g eth0

Ring parameters for eth0: Pre-set maximums: RX: 1020 RX Mini: 0 RX Jumbo: 4080 TX: 255 Current hardware settings: RX: 255 RX Mini: 0 RX Jumbo: 0 TX: 255

2.ethtool -G eth0 rx 1000 ethtool -g eth0

Ring parameters for eth0: Pre-set maximums: RX: 1020 RX Mini: 0 RX Jumbo: 4080 TX: 255 Current hardware settings: RX: 1000 RX Mini: 0 RX Jumbo: 0 TX: 255

ifconfig

eth0 Link encap:Ethernet HWaddr 00:26:B9:3B:XX:C3 inet addr:61.255.xx.xx Bcast:61.255.xx.xx Mask:255.255.255.192 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1348879 errors:0 dropped:2714 overruns:0 frame:0 TX packets:1449564 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:646430926 (616.4 MiB) TX bytes:576842481 (550.1 MiB) Interrupt:82 Memory:da000000-da012800

ethtool -S eth0

NIC statistics: rx_bytes: 645417070 rx_error_bytes: 0 tx_bytes: 575096746 tx_error_bytes: 0 rx_ucast_packets: 1345249 rx_mcast_packets: 17 rx_bcast_packets: 826 tx_ucast_packets: 1446406 tx_mcast_packets: 0 tx_bcast_packets: 0 tx_mac_errors: 0 tx_carrier_errors: 0 rx_crc_errors: 0 rx_align_errors: 0 tx_single_collisions: 0 tx_multi_collisions: 0 tx_deferred: 0 tx_excess_collisions: 0 tx_late_collisions: 0 tx_total_collisions: 0 rx_fragments: 0 rx_jabbers: 0 rx_undersize_packets: 0 rx_oversize_packets: 0 rx_64_byte_packets: 620303 rx_65_to_127_byte_packets: 87492 rx_128_to_255_byte_packets: 36556 rx_256_to_511_byte_packets: 212099 rx_512_to_1023_byte_packets: 45961 rx_1024_to_1522_byte_packets: 343681 rx_1523_to_9022_byte_packets: 0 tx_64_byte_packets: 368814 tx_65_to_127_byte_packets: 714315 tx_128_to_255_byte_packets: 13048 tx_256_to_511_byte_packets: 18258 tx_512_to_1023_byte_packets: 39752 tx_1024_to_1522_byte_packets: 292219 tx_1523_to_9022_byte_packets: 0 rx_xon_frames: 0 rx_xoff_frames: 0 tx_xon_frames: 0 tx_xoff_frames: 0 rx_mac_ctrl_frames: 0 rx_filtered_packets: 0 rx_discards: 0 rx_fw_discards: 2704

rx_fw_discards: 2704 问题没有解决,依然丢包

二.更新网卡驱动 lsmod |grep bnx2

bnx2 209997 0

ethtool -i eth0

driver: bnx2 version: 1.9.3 firmware-version: 5.0.6 NCSI 2.0.3 bus-info: 0000:01:00.0

modinfo bnx2

filename: /lib/modules/2.6.18-164.el5/kernel/drivers/net/bnx2.ko version: 1.9.3 license: GPL description: Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver author: Michael Chan srcversion: D151EAED8C1037CA480DE9A alias: pci:v000014E4d0000163Csv*sd*bc*sc*i* alias: pci:v000014E4d0000163Bsv*sd*bc*sc*i* alias: pci:v000014E4d0000163Asv*sd*bc*sc*i* alias: pci:v000014E4d00001639sv*sd*bc*sc*i* alias: pci:v000014E4d000016ACsv*sd*bc*sc*i* alias: pci:v000014E4d000016AAsv*sd*bc*sc*i* alias: pci:v000014E4d000016AAsv0000103Csd00003102bc*sc*i* alias: pci:v000014E4d0000164Csv*sd*bc*sc*i* alias: pci:v000014E4d0000164Asv*sd*bc*sc*i* alias: pci:v000014E4d0000164Asv0000103Csd00003106bc*sc*i* alias: pci:v000014E4d0000164Asv0000103Csd00003101bc*sc*i* depends: vermagic: 2.6.18-164.el5 SMP mod_unload gcc-4.1 parm: disable_msi:Disable Message Signaled Interrupt (MSI) (int) parm: enable_entropy:Allow bnx2 to populate the /dev/random entropy pool (int) module_sig: 883f3504a9f766557f09578a977b7e112ebf209f6aab61295466fb787675fec1378b254df8d186609f705f1f37e06d7e2958667d258f6afe6ac1621228

1.从官网下载驱动 http://zh-cn.broadcom.com/support/ethernet_nic/netxtremeii.php

Linux iSCSI HBA only supported on RHEL 5.4, SUSE SLES 11 SP1 or newer versions of these distributions 6.2.23 03/18/11
24MB

2.安装包 unzip linux-6.2.23.zip cd Server/Linux/Driver/ rpm -ivh netxtreme2-6.2.23-1.src.rpm

1:netxtreme2 ########################################### [100%]

3.编译 cd /usr/src/redhat/ rpmbuild -bb SPECS/netxtreme2.spec

Wrote: /usr/src/redhat/RPMS/x86_64/netxtreme2-6.2.23-1.x86_64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.43778 + umask 022 + cd /usr/src/redhat/BUILD + cd netxtreme2-6.2.23 + rm -rf /var/tmp/netxtreme2-buildroot /usr/src/redhat/BUILD/file.list.netxtreme2 + exit 0

exit 0表示成功(1-255是失败)

4.安装生成的rpm包 cd RPMS/x86_64/ rpm -ivh netxtreme2-6.2.23-1.x86_64.rpm

Preparing… ########################################### [100%] 1:netxtreme2 ########################################### [100%]

新的驱动会生成在/lib/modules/2.6.18-164.el5/updates/

5.加载驱动 depmod -a modprobe bnx2 service network restart lsmod |grep bnx2

bnx2 209997 0

ethtool -i eth0

driver: bnx2 version: 1.9.3 firmware-version: 5.0.6 NCSI 2.0.3 bus-info: 0000:01:00.0

看着好像没区别,modinfo可以看到详细信息 modinfo bnx2

filename: /lib/modules/2.6.18-164.el5/updates/bnx2.ko version: 2.0.23b license: GPL description: Broadcom NetXtreme II BCM5706/5708/5709/5716 Driver author: Michael Chan srcversion: 6E0DD070AB24C11F50B2712 alias: pci:v000014E4d0000163Csv*sd*bc*sc*i* alias: pci:v000014E4d0000163Bsv*sd*bc*sc*i* alias: pci:v000014E4d0000163Asv*sd*bc*sc*i* alias: pci:v000014E4d00001639sv*sd*bc*sc*i* alias: pci:v000014E4d000016ACsv*sd*bc*sc*i* alias: pci:v000014E4d000016AAsv*sd*bc*sc*i* alias: pci:v000014E4d000016AAsv0000103Csd00003102bc*sc*i* alias: pci:v000014E4d0000164Csv*sd*bc*sc*i* alias: pci:v000014E4d0000164Asv*sd*bc*sc*i* alias: pci:v000014E4d0000164Asv0000103Csd00003106bc*sc*i* alias: pci:v000014E4d0000164Asv0000103Csd00003101bc*sc*i* depends: vermagic: 2.6.18-164.el5 SMP mod_unload gcc-4.1 parm: disable_msi:Disable Message Signaled Interrupt (MSI) (int) parm: stop_on_tx_timeout:For debugging purposes, prevent a chip reset when a tx timeout occurs (int)

观察一段时间没有问题

20110607更新 附加进一步解决方法

在/etc/modprobe.conf中加入一行

options bnx2 disable_msi=1

创建一个脚本来重启服务 vi net.sh

/etc/init.d/network stop rmmod bnx2 modprobe bnx2 /etc/init.d/network start

chmod a+x net.sh ./net.sh

参考: http://www.pcwind.net/dell-r410.html http://bbs.linuxtone.org/thread-3813-1-1.html

Posted in linux 维护优化, 技术.

Tagged with , , , .


Lempelf一键包for rhel/centos 64bit发布

Lempelf一键安装包是什么?

Lempelf一键安装包是用Shell编写的在Linux平台快速安装nginx+php+mysql的Shell程序。

我们为什么需要它?

编译安装需要输入大量的命令,如果是配置生产环境需要耗费大量的时间。 不会Linux的站长或Linux新手想使用Linux作为生产环境……

它有什么优势?

无需一个一个的输入命令,无需值守,编译安装优化编译参数,提高性能,解决不必要的软件间依赖。

介绍及下载:https://blog.c1gstudio.com/lempelfpage

Posted in Lempelf一键包, shell, 技术.

Tagged with .