In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The company rented Aliyun machine in Japan with network delay and a Linux server dedicated to running game services. due to historical reasons, coupled with the sharp increase in the number of players, there are often a large number of sleep processes.
Get a script to kill the sleep process:
While: don = `MySQL-uroot-pfuckdba processlist | grep-I sleep | wc-l`date= `date +% Y%m%d\ [% H:%M:%S] `echo $n if ["$n"-gt 10] then for i in `mysqladmin-uroot-pfuckdba processlist | grep-I sleep | awk'{print $2} '`do mysqladmin-uroot-pfuckdba kill $i done echo "sleep is too many i killed it" > > / root/tmp/ Sleep.log echo "$date: $n" > / root/tmp/sleep.log fi sleep 120 # execute done every 120 seconds
There is an upper limit on the maximum number of connections supported by the MySQL server, because the establishment of each connection consumes memory, so we hope that the client should disconnect and release the occupied memory after connecting to the MySQL Server to handle the corresponding operation. If your MySQL Server has a large number of idle connections, they will not only consume memory in vain, but also if the connections continue to accumulate and keep opening, they will eventually reach the upper limit of MySQL Server connections, which will report an error in 'too many connections'. The setting of the value of wait_timeout should be judged according to the operation of the system. After the system has been running for a period of time, you can check the connection status of the current system through the show processlist command. If you find that there are a large number of connection processes with sleep status, it means that the parameter setting is too large and can be adjusted smaller appropriately.
After query, it is found that the original mysql has not been optimized, or the original default value: 28800 (that is, 8 hours)
Edit / etc/my.cnf, add the timeout parameter under mysqld and set it to 120 seconds, as follows:
[mysqld]
Wait_timeout=120
Interactive_timeout=120
Note: interactive_timeout and wait_timeout must be set at the same time to take effect.
After the test server test, there is no problem, restart mysql can take effect! Of course, the online ones are rather crappy, because the server was rented on the first day, and there was no time to optimize it the next day. There is only one in many stations, and the execution of the command is relatively slow, so we are waiting for the next replacement file to restart.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.