MySQL Monitoring management tool--innotop
1.innotop Installation
Reference official website: http://innotop.googlecode.com/svn/html/installing.html
# wget http://innotop.googlecode.com/files/innotop-1.9.0.tar.gz
# TAR-ZXVF Innotop-1.9.0.tar.gz
# CD innotop-1.9.0
Installing the Innotop tool is very simple, it is written by Perl, and of course requires the Perl environment and the associated toolkit. Before installing, make sure that your system has the Time::hires,term::readkey,dbi,dbd::mysql four packages installed.
# Perl-mcpan-eshell
Cpan> Install Time::hires
Cpan> Install Term::readkey
Cpan> Install DBI
Cpan> Install Dbd::mysql
The following are the installation help files under the extracted source path:
# Perl makefile.pl
If there is no error, then use the
# make Install
This installs the Innotop, after the installation the system will have one more command, Innotop
Get help
# Innptop--help
Reference official website: http://innotop.googlecode.com/svn/html/manual.html
Innotop explanation--Very detailed: http://wenku.baidu.com/link?url=0cvUfYA5gwKfwvoo1gGPkr9NfK1eZ5UHa3gAhXB-pwlOLQDyH_Y_ Bn8q5kfii89rz_9egwjjlwmiqbsz4hogg0a-w1ngvnbmbrlqwmxgwz_
There is a slow parameter in the query list, which can be configured in the/ETC/MY.CNF configuration file using the
It records all SQL statements that execute more than long_query_time time, helping you to find SQL that executes slowly, so we can optimize these SQL.
-----How to turn on MySQL slow query-----
1. first, go to MySQL and enter the command show variables like '%quer% ';
You will see where the log_slow_queries status is off;long_query_time for 10;
2. Edit the/etc/my.cnf file
Add two lines below [mysqld]:
Log-slow-queries =/var/lib/mysql/mysql-slow.log
Long_query_time = 3
Log-slow-queries the directory for the log, Long_query_time is the maximum number of seconds to query (set according to your own needs).
3. Restart the service to make the configuration effective
/etc/init.d/mysqld restart
Re-enter database query log_slow_queries status is on.