In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
First of all, use the user to log in to the linux client and execute the command mysql-u mjb-p. Mjb is the user name of the database, and the system will prompt you to enter the password and enter the password to enter. The login is successful.
Enter the command show variables like 'slow_query_log', page to show whether the slow log is enabled. Slow_query_log = ON, which means it has been opened.
If it is not enabled, you need to execute the command set global slow_query_log=on;. Set log_queries_not_using_indexes to enable the monitoring input command show variables like 'log_queries_not_using_indexes';log_queries_not_using_indexes=OFF to use the index, which means that it is not enabled. You need to execute the command set global log_queries_not_using_indexes=on
-set the monitoring threshold through long_query_time, that is, record more than a few seconds (in seconds). Here, set it to 0.1, that is, enter the command show variables like 'long_query_time' in 100ms.
The system setting is 1 second. If you need to modify it to 0.1 second, you need to execute the following command: set global long_query_time=0.1;. Through the above design, you can basically start the optimization work. Set global is only a global session that takes effect and expires after restart. If you need the above configuration to take effect permanently, you need to configure [mysqld] in mysql.cnf.
Slow_query_log = 1
Log_queries_not_using_indexes = 1
Long_query_time = 0.1
Slow_query_log_file = / apps/logs/mysql/slow3306.log
If it is linux, restart it by the following command or other means such as service
Start: / etc/init.d/mysqld (mysql) start
Stop: / etc/init.d/mysqld (mysql) stop
Restart: / etc/init.d/mysqld (mysql) restart
Finally, check the location of the slow log, and execute the command show variables like 'slow_query_log_file'\ G by viewing slow_query_log_file.
The log records displayed are tested in the / apps/logs/mysql/slow3306.log directory
Record success-Field name meaning value Timeint type timestamp plus time 180913 10:39:57User@Host host information MJB [MJB] @ localhost [] Thread_ id thread id5271182Query_time execution time 2.000219Lock_time lock time 0.000000Rows_sent returns the number of records 1Rows_examined scan rows 0SET timestampSQL execution time 1536806397select sleep (2) SQL statement select sleep (2) If the setting is successful and the performance test is complete, you can view the monitored slow SQL log files to see which SQL statements need to be optimized.
if the article is helpful to you, you can click on the follow function in the lower right corner. Welcome to forward and clap the brick. I will continue to launch articles related to the test and share the testing technology with you. Every original article is written attentively to put an end to plagiarism and copying. The official Wechat account is synchronized with the articles on this platform for easy reference.
QQ technology exchange group: please enter the verification information 51CTO to add the group.
Wechat QR code follow official account:
After following, reply to the resource download, and you can get the download address of all kinds of resources shared by yourself.
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.