首页 > 代码库 > 安装并使用pt-ioprofile

安装并使用pt-ioprofile

    pt-ioprofile,是一个percona的性能分析工具,可以查看进程输出、输入,打印一些表文件及活动IO。pt-ioprofile是一个只读工具,所以对数据没风险。由于网上对pt-ioprofile的安装说明比较少,很多小伙伴都无从下手^.^

下面介绍一下pt-ioprofile的安装过程:

#!/bin/bashtoolkit(){version=$(cat /etc/redhat-release | awk {print $3} | awk -F . {print $1})if [ $version -eq 6 ]then   rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmelse   rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpmfiyum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes -ywget http://www.percona.com/downloads/percona-toolkit/LATEST/RPM/percona-toolkit-2.2.11-1.noarch.rpmrpm -ivh percona-toolkit-2.2.11-1.noarch.rpm}toolkit

如果安装过程报以下错误

Error: Cannot retrieve metalink for repository: epel. Please verify its path and try againerror: Failed dependencies:        perl(DBI) >= 1.13 is needed by percona-toolkit-2.2.11-1.noarch        perl(DBD::mysql) >= 1.0 is needed by percona-toolkit-2.2.11-1.noarch        perl(Time::HiRes) is needed by percona-toolkit-2.2.11-1.noarch        perl(IO::Socket::SSL) is needed by percona-toolkit-2.2.11-1.noarch

原因是rpm -Uvh装了个epel的扩展后,出现了yum安装不了东西,解决办法是编辑/etc/yum.repos.d/epel.repo,把基础的恢复,镜像的地址注释掉,

#baseurlmirrorlist改成baseurl#mirrorlist

再运行脚本安装即可
请参考:http://www.cnblogs.com/cenalulu/archive/2013/04/12/3016714.html

请参考http://www.percona.com/doc/percona-toolkit/2.0/pt-ioprofile.html

安装并使用pt-ioprofile