=============
Welcome reprint, please indicate the source
Li Hui (DBA)
Date: 20151008
=============
1 Installing Percona Toolkit
Go to official website to download
2. Installing Anemometer
: Https://github.com/box/Anemometer
3. Download PHP related modules
Yum-y Install php*
Mainly look at these modules:
Php-common-5.3.3-1.el5
Php-bcmath-5.3.3-1.el5
Php-mysql-5.3.3-1.el5
Php-dba-5.3.3-1.el5
Php-cli-5.3.3-1.el5
Php-gd-5.3.3-1.el5
Php-5.3.3-1.el5
Php-pdo-5.3.3-1.el5
4. Launch Apache Service
Rpm-qa|grep http
Httpd-2.2.3-45.el5
5. Execute the setup script to create the user:
[[Email Protected]/var/www/html/anemometer]mysql-uroot-pxxx < Install.sql
[[Email protected]/var/www/html/anemometer]mysql-uroot-pxxx
MySQL > Grant all on slow_query_log.* to ' anemometer ' @ ' percent ' identified by ' 123456 ';
MySQL > Grant all on slow_query_log.* to ' anemometer ' @ ' localhost ' identified by ' 123456 ';
MySQL > Grant SELECT on * * to ' anemometer ' @ '% ';
MySQL > Grant all on slow_query_log.* to ' anemometer ' @ ' localhost ';
MySQL > Grant SELECT on * * to ' anemometer ' @ ' localhost ';
6. Modify the PHP configuration file:
Vim/etc/php.ini
7. Modify the Web page:
Cd/var/www/html/anemometer/conf
CP sample.config.inc.php config.inc.php
VI config.inc.php
And
8. Modify the Apache configuration file "
cat/etc/httpd/conf/httpd.conf |grep "ServerName" |grep-v ' ^# '
ServerName 10.1.11.99:80
Restart HTTP, can not access, error is as follows:
Tail-f/etc/httpd/logs/error_log
Here's how to fix it:
9: Visit page:
10.1.11.99/anemometer
11. Import Slow Query log
Pt-query-digest--user=anemometer--password=123456--socket=/tmp/mysql3306.sock--review h=localhost,D=slow_query_ Log,t=global_query_review--history h=localhost,d=slow_query_log,t=global_query_review_history--no-report--limit =0%--filter= "\ $event->{bytes} = Length (\ $event->{arg}) and \ $event->{hostname}=\" $HOSTNAME \ ""/opt/soft/ Slow_query_2015-09-24.log
Reference: http://www.bubuko.com/infodetail-495427.html
Https://github.com/box/Anemometer
http://blog.itpub.net/26355921/viewspace-1162415/
Visualize MySQL slow query using anemometer based on Pt-query-digest