When you use netstat-an to view the system connection status, a large number of TIME_WAIT connections are found, all of which are mysql. Then google, and the following is a solution. [Root @ blog ~] # Netstat-anActiveInternetconnections (serversandestablished) ProtoRecv-QSend-QLocalAddressForeignAddressS
Use netStat-An large number of TIME_WAIT connections are found when you view the system connection status, all of which are mysql. Then google, and the following is a solution.
[Root @ blog ~] #Netstat-
Active Internet connections (servers and establishEd)
Proto Recv-Q Send-Q LocalDdRess Foreign Address State
TCp0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 11211 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 80 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 43389 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43388 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43387 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43382 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43381 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43380 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43379 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 43378 127.0.0.1: 3306 TIME_WAIT
Tcp 0 0 127.0.0.1: 11211 127.0.0.1: 38792 ESTABLISHED
Tcp 0 0 127.0.0.1: 11211 127.0.0.1: 38799 ESTABLISHED
Solution
# Vi/etc/sysctl. conf. Add the following content at the end of the file:
Net. ipv4.tcp _ syNcOokies = 1
Net. ipv4.tcp _ tw_reuse = 1
Net. ipv4.tcp _ tw_recycle = 1
Net. ipv4.tcp _ fin _TimeOut = 30
# Sysctl-p // make the modified kernel take effect
Option description
Net. ipv4.tcp _SyncOokies = 1 // indicates enabling SYN Cookies. When a SYN wait queue overflows, cookies are enabled to prevent a small number of SYN attacks. The default value is 0, indicating that the operation is disabled.
Net. ipv4.tcp _ tw_reuse = 1 // indicates enabling reuse. Allow TIME-WAIT sockets to be re-used for new TCP connections. The default value is 0, indicating that it is disabled.
Net. ipv4.tcp _ tw_recycle = 1 // indicates to enable fast TIME-WAIT sockets recovery in the TCP connection. The default value is 0, indicating to disable TIME-WAIT sockets.
Net. ipv4.tcp _ fin_timeout // modify the system? Default TIMEOUT time.