MySQL time_wait connection Too many workarounds

Source: Internet
Author: User


Today the MySQL server looked at concurrency and found the following conditions

MySQL time_wait connection too much, scared me to jump, because this server I rarely to manage, today suddenly want to come up to see, found this problem. Here's how I fix it.


[Email protected] data]# Ss-an | grep 3306 | Wc-l
1402
[[email protected] data] #mysql-uroot-p


Mysql> Show variables like "Time_timeout";

| Wait_timeout | 28800 |

Finally found the problem, here the timeout time is 28,800 seconds 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0004.gif "alt=" J_0004.gif "/>

Then I'll use the following steps to resolve it.


1, add the following content in the/etc/sysctl.conf

Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 30


Then use the Sysctl-p command to take it into effect


2, add the following content in/ETC/MY.CNF

Add #在 [mysqld]

[Mysqld]

#这个参数是修改上面查询到的28800秒, I modified it for 30 seconds.

Wait_timeout = 30


3, restart the server can

Of course, this method is very stupid, if it is a server on the line do not use this method.


If you cannot restart the service, you can modify the global variables directly

mysql> set global wait_timeout=30;





This article is from the "Xiao Mo" blog, please be sure to keep this source http://xiaofengmo.blog.51cto.com/10116365/1752160

MySQL time_wait connection Too many workarounds

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.