pt-query-digest :分析查询执行日志,并产生一个查询报告
[root@472322 percona-toolkit-2.2.5]# pt-query-digest --help
Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/pt-query-digest line 3187.
BEGIN failed--compilation aborted at /usr/local/bin/pt-query-digest line 3187.
解决方案:
.pm实际上是Perl的包,只需安装如下软件包即可:
yum install -y perl-Time-HiRes
[root@472322 percona-toolkit-2.2.5]#
yum install perl-Time-HiRes
Loaded plugins: dellsysid, fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: mirror.rackspace.com
* dell-community: linux.dell.com
* epel: fedora-epel.mirror.lstn.net
* extras: mirrordenver.fdcservers.net
* updates: centos.mirror.lstn.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-Time-HiRes.x86_64 4:1.9721-131.el6_4 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================================
Installing:
perl-Time-HiRes x86_64 4:1.9721-131.el6_4 updates 47 k
............................... 此处省略..............................
Running Transaction
Installing : 4:perl-Time-HiRes-1.9721-131.el6_4.x86_64 1/1
Verifying : 4:perl-Time-HiRes-1.9721-131.el6_4.x86_64 1/1
Installed:
perl-Time-HiRes.x86_64 4:1.9721-131.el6_4
Complete!
Ok,可以查看pt-query-digest工具的功能介绍了:
[root@472322 percona-toolkit-2.2.5]# pt-query-digest --help
pt-query-digest analyzes MySQL queries from slow, general, and binary log files.
It can also analyze queries from C<SHOW PROCESSLIST> and MySQL protocol data
from tcpdump. By default, queries are grouped by fingerprint and reported in
descending order of query time (i.e. the slowest queries first). If no C<FILES>
are given, the tool reads C<STDIN>. The optional C<DSN> is used for certain
options like L<"--since"> and L<"--until">. For more details, please use the
--help option, or try 'perldoc /usr/local/bin/pt-query-digest' for complete
documentation.
Usage: pt-query-digest [OPTIONS] [FILES] [DSN]
Options:
--ask-pass Prompt for a password when connecting to MySQL
--attribute-aliases=a List of attribute|alias,etc (default db|Schema)
--attribute-value-limit=i A sanity limit for attribute values (default
4294967296)
--charset=s -A Default character set
--config=A Read this comma-separated list of config files;
if specified, this must be the first option on
the command line
--[no]continue-on-error Continue parsing even if there is an error (
default yes)
--[no]create-history-table Create the --history table if it does not exist (
default yes)
--[no]create-review-table Create the --review table if it does not exist (
default yes)
--daemonize Fork to the background and detach from the shell
--database=s -D Connect to this database
--defaults-file=s -F Only read mysql options from the given file
--embedded-attributes=a Two Perl regex patterns to capture pseudo-
attributes embedded in queries
....................................
分析本地的慢查询文件:
pt-query-digest --user=root --password=m@123 /data/dbdata/localhost-slow.log
重新回顾满查询日志,并将结果保存到query_review中,注意query_review表的表结构必须先建好,表结构如下:
CREATE TABLE query_review (
checksum BIGINT UNSIGNED NOT NULL PRIMARY KEY,
fingerprint TEXT NOT NULL,
sample TEXT NOT NULL,
first_seen DATETIME,
last_seen DATETIME,
reviewed_by VARCHAR(20),
reviewed_on DATETIME,
comments TEXT
);
命令如下:
pt-query-digest --user=root --password=m@123 --review h=localhost,D=test,t=query_review /data/dbdata/localhost-slow.log
分享到:
相关推荐
pt-query-digest是一个用于分析MySQL慢查询的工具。 官网最新版本:percona-toolkit-3.2.1_x86_64.tar.gz
pt-query-digest、pt-summary 、pt-slave-find、pt-mysql-summary...
pt-query-digest是用于分析mysql慢查询的一个工具,它可以分析binlog、General log、slowlog,也可以通过SHOWPROCESSLIST或者通过tcpdump抓取的MySQL协议数据来进行分析。可以把分析结果输出到文件中,分析过程是先...
MK-QUERY-DIGEST也是一个用Perl脚本写的转存储日志分析程序。和MYSQLDUMPSLOW一样,也可以...在使用MK-QUERY-DIGEST工具之前必须要确保已经开启了慢日志,如何开启慢日志请参考《MYSQL慢查询日志功能的开启方法.doc》。
matsuu / pt-query-digest 用法 分析慢查询日志 cat mysql-slow.log | docker run -i --rm matsuu/pt-query-digest > analyzed-slow.log 分析tcpdump cat dump.log | docker run -i --rm matsuu/pt-query-digest ...
使用pt-query-digest分析mysqlslowquerylog[参考].pdf
pt-query-digest安装后报错
pt-config-diff pt-heartbeat pt-query-digest pt-table-checksum pt-deadlock-logger pt-index-usage pt-show-grants pt-table-sync pt-diskstats pt-ioprofile pt-sift pt-table-usage pt-duplicate-key-checker ...
pt-query-digest --user=anemometer --password=123456 --port=3306 \ --review h=192.168.0.114,D=slow_query_log,t=global_query_review \ --history h=192.168.0.114,D=slow_query_log,t=global_query_review_...
根据《Mysql高性能》一书作者的推荐,使用pt-quest-digest工具能够有效分析mysql慢查询,有助理快速定位应用程序mysql性能瓶颈,并有针对性地进行查询sql优化或数据库的优化。 pt-query-digest是一个perl语言编写...
Authorization: Digest算法 第一次http://192.168.16.223/ISAPI/Streaming/channels/33/picture 返回头中Authorization参数用于此计算,得出新的Authorization,放于头中再次请求就得到图片
/bin/sh#使用前安装yum -y install perl-DBD-MySQL perl-Digest-MD5 perl-DBI libev#yum install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MySQL -y#yum -y install rsync perl l perl-Digest...
t-digest-3.2.jar
powerful delegations it is able to let you use it for any kind of files, ie it can also digest manual pages, dvi files, texinfo, .... Among the other most noticeable features of a2ps are: − various ...
More of this patch may be required I just haven't had time to digest it all. Jan 2006 Wow an update :-) Needed to implement the IPR (Interrupt Pending Register) in order to work with a bug fix ...
二 性能分析工具介绍(mytop,innotop,orzdba,tcpdump,pt-query-digest,tbdba-slow-picker.pl,iotop,io-profile,nicstat,mpstat,iostat,vmstat,tcprstat,dstat,oprofile,vmtouch) 三 主从复制延时解决(relay-fetch...
pt系列工具,用于分析数据库日志,如慢sql等。包含pt-mysql-summary,pt-query-digest等一系列插件工具
-I../lib -I/win32dev/misc/wget/out2/include -O2 -Wall Link: i686-w64-mingw32-gcc -O2 -Wall -L/win32dev/misc/wget/out2/lib /win32dev/misc/wget/out2/lib/libiconv.a /win32dev/misc/wget/out2/lib/...