mysql TIME_WAIT ; too many connections problem

后端 未结 3 1994
心在旅途
心在旅途 2021-02-06 16:47

When i was checking for mysql load time on site. i got result showing connections as TIME_WAIT. Even though i close connection on every page. Sometimes the site doesnt load say

3条回答
  •  误落风尘
    2021-02-06 17:23

    If you are getting alot of TIME_WAIT connections on the Mysql Server then that means that Mysql server is closing the connection. The most likely case in this instance would be that a host or several hosts got on a block list. You can clear this by running

    mysqladmin flush-hosts
    

    to get a list of the number of connections you have per ip run,

     netstat -nat | awk {'print $5'} | cut -d ":" -f1 | sort | uniq -c | sort -n
    

    you can also confirm this is happening by going to one of your clients that is having trouble connecting and telnet to port 3306. It will thow a message with something like,

    telnet mysqlserver 3306
    Trying 192.168.1.102...
    Connected to mysqlserver.
    Escape character is '^]'.
    sHost 'clienthost.local' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.
    

提交回复
热议问题