@llplmlyd
2023-05-11T11:34:08.000000Z
字数 1249
阅读 205
数据库-tools
refer https://www.percona.com/doc/percona-toolkit/LATEST/pt-query-digest.html#downloading
# You can also get individual tools from the latest release:
wget percona.com/get/TOOL
Replace TOOL with the name of any tool.
## 安装依赖
yum install perl-DBI
yum install perl-DBD-MySQL
yum install perl-Time-HiRes
yum install perl-IO-Socket-SSL
yum install perl-Digest-MD5
下载pt-query-disgest 、 授权 、 将其放到/usr/bin下:
wget percona.com/get/pt-query-digest
chmod u+x pt-query-digest
mv /usr/src/pt-query-digest /usr/bin/
https://aws.amazon.com/cn/blogs/china/pt-query-digest-rds-mysql-slow-searchnew/
## 系统版本 3.10.0-957.el7.x86_64 cnetos7
wget percona.com/get/pt-query-digest
chmod a+x pt-query-digest
mv pt-query-digest /usr/sbin/
## 测试使用 发现报错,没有找到 Digest/MD5.pm文件 参照网上内容,增加yum install perl-Digest-MD5 解决
pt-query-digest --help
Can't locate Digest/MD5.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/sbin/pt-query-digest line 2492.
BEGIN failed--compilation aborted at /usr/sbin/pt-query-digest line 2492.
# 再次测试 可以正常使用
## --since 起始时间
## --until 截止时间
pt-query-digest --since '2021-09-28 07:40:00' --until'2021-09-28 08:00:00' tidb_slow_query-2021-09-28T07-42-14.582.log