服务器报“TCP: time wait bucket table overflow”错

最近换了centos 6.2的系统,Socket通信监控总是报错:"TCP连接超时",在看到了messages文件后,发现有很多日志写入,且内容基本一致如下:

Apr 29 10:47:25 localhost kernel: __ratelimit: 243 callbacks suppressed

Apr 29 10:47:25 localhost kernel: TCP: time wait bucket table overflow

Apr 29 10:47:25 localhost kernel: TCP: time wait bucket table overflow

Apr 29 10:47:25 localhost kernel: TCP: time wait bucket table overflow

Apr 29 10:47:32 localhost kernel: TCP: time wait bucket table overflow

10:47:37 localhost kernel: __ratelimit: 210 callbacks suppressed

于是谷歌了一番,终于解决问题,此报错日志大致是说服务器上TIME_WAIT的最大值已达到系统的预设,可以用此命令查询出:

# netstat -an | grep 80 |awk '{print $6}' | sort | uniq -c | sort -rn    

138 TIME_WAIT    

135 ESTABLISHED    

21 CONNECTED    

5 FIN_WAIT2    

4 FIN_WAIT1    

2 LISTEN    

1 LAST_ACK

对于解决的方法就是更改/etc/sysctl.conf配置文件,将net.ipv4.tcp_max_tw_buckets = 6000数值改大点 比如改成net.ipv4.tcp_max_tw_buckets = 16000

sysctl -p生效

posted @ 2013-06-05 09:51  中国公民  阅读(673)  评论(0)    收藏  举报