Visualize MySQL slow query using anemometer based on Pt-query-digest

Source: Internet
Author: User
Tags install php

=============

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.