[MySQL 工具] pt-query-digest使用出错问题分析Can't locate Time/HiRes.pm in @INC
2013-11-05 22:41
936 查看
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
....................................
分析本地的慢查询文件:
重新回顾满查询日志,并将结果保存到query_review中,注意query_review表的表结构必须先建好,表结构如下:
命令如下:
[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
相关文章推荐
- Can't locate Time/HiRes.pm in @INC错误的处理方法 perl安装不全
- perl安装不全导致的Can't locate Time/HiRes.pm in @INC错误的处理方法
- Can't locate Time/HiRes.pm in @INC
- 解决"Can't locate Time/HiRes.pm in @INC"问题
- OpenResty中遇到"Can't locate Time/HiRes.pm in @INC"问题的解决方法
- mysql 慢查询分析工具:pt-query-digest 在mac 上的安装使用
- mysql 慢查询分析工具:pt-query-digest 在mac 上的安装使用
- Can't locate Time/HiRes.pm
- Can't locate ExtUtils/MakeMaker.pm in @INC 错误的解决方式
- pt-diskstats 报错 Can't locate Time/HiRes.pm in @INC
- Can't locate ExtUtils/MakeMaker.pm in @INC
- tcpdump&pt-query-digest分析mysql负载性能问题
- MySQL分析工具之pt-query-digest
- mysql慢查日志分析神器:pt-query-digest查询日志分析工具
- pt-query-digest查询日志分析工具 - percona-toolkit使用教程之系统类工具
- mysql慢查询分析工作pt-query-digest的使用
- 使用pt-query-digest分析mysql
- 使用pt-query-digest分析mysql slow query log
- 使用pt-query-digest分析mysql slow query log
- 使用pt-query-digest分析mysql slow query log