debian8安装percona-toolkit检测mysql的索引和慢查询分析

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了debian8安装percona-toolkit检测mysql的索引和慢查询分析相关的知识,希望对你有一定的参考价值。

今天打算安装体验:percona-toolkit_3.0.4-1.jessie_amd64.deb  来检测mysql的索引和慢查询分析
但是遇到了缺少:libmysqlclient18和libdbd-mysql-perl的问题
解决方案:
 https://packages.debian.org/jessie/amd64/libdbd-mysql-perl/download
 https://packages.debian.org/jessie/amd64/libmysqlclient18/download
下载好:通过dpkg -i来安装
A:安装percona-toolkit_3.0.4-1.jessie_amd64.deb
 下载地址:https://www.percona.com/doc/percona-repo-config/apt-repo.html
  安装:apt-get install percona-toolkit

 文档参考:https://www.percona.com/doc/percona-toolkit/LATEST/index.html
1:遇到的问题:
[email protected]:~# !pt
pt-duplicate-key-checker --port=3306  --password=ops12300.--host=localhost  --user=ops
Cannot connect to MySQL because the Perl DBD::mysql module is not installed or not found.  Run 'perl -MDBD::mysql' to see the directories that Perl searches for DBD::mysql.  If DBD::mysql is not installed, try:
  Debian/Ubuntu  apt-get install libdbd-mysql-perl
  RHEL/CentOS    yum install perl-DBD-MySQL
  OpenSolaris    pgk install pkg:/SUNWapu13dbd-mysql

2:下载libdb-mysql-perl软件包:  https://packages.debian.org/jessie/amd64/libdbd-mysql-perl/download

   [email protected]:~# dpkg -i libdbd-mysql-perl_4.028-2+deb8u2_amd64.deb
正在选中未选择的软件包 libdbd-mysql-perl。
(正在读取数据库 ... 系统当前共安装有 68528 个文件和目录。)
正准备解包 libdbd-mysql-perl_4.028-2+deb8u2_amd64.deb  ...
正在解包 libdbd-mysql-perl (4.028-2+deb8u2) ...
dpkg: 依赖关系问题使得 libdbd-mysql-perl 的配置工作不能继续:
 libdbd-mysql-perl 依赖于 libmysqlclient18 (>= 5.5.24+dfsg-1);然而:
  未安装软件包 libmysqlclient18。
dpkg: 处理软件包 libdbd-mysql-perl (--install)时出错:
 依赖关系问题 - 仍未被配置
正在处理用于 man-db (2.7.0.2-5) 的触发器 ...
在处理时有错误发生:
 libdbd-mysql-perl

3:下载libmysqlclient18软件包: https://packages.debian.org/jessie/amd64/libmysqlclient18/download
4:安装
[email protected]:~# dpkg -i libmysqlclient18_5.5.57-0+deb8u1_amd64.deb
(正在读取数据库 ... 系统当前共安装有 68575 个文件和目录。)
正准备解包 libmysqlclient18_5.5.57-0+deb8u1_amd64.deb  ...
正在将 libmysqlclient18:amd64 (5.5.57-0+deb8u1) 解包到 (5.5.57-0+deb8u1) 上 ...
正在设置 libmysqlclient18:amd64 (5.5.57-0+deb8u1) ...
正在处理用于 libc-bin (2.19-18+deb8u10) 的触发器 ...
[email protected]:~# dpkg -i libdbd-mysql-perl_4.028-2+deb8u2_amd64.deb
(正在读取数据库 ... 系统当前共安装有 68575 个文件和目录。)
正准备解包 libdbd-mysql-perl_4.028-2+deb8u2_amd64.deb  ...
正在将 libdbd-mysql-perl (4.028-2+deb8u2) 解包到 (4.028-2+deb8u2) 上 ...
正在设置 libdbd-mysql-perl (4.028-2+deb8u2) ...
正在处理用于 man-db (2.7.0.2-5) 的触发器 ...

5:测试使用
[email protected]:~# pt-duplicate-key-checker --port=3306  --password=ops12300.  --host=localhost  --user=ops --socket=/tmp/mysql.sock
# A software update is available:
# ########################################################################
# forge.erp_agent_community
# ########################################################################


# agent_community_agent_id_index is a left-prefix of PRIMARY
# Key definitions:
#   KEY `agent_community_agent_id_index` (`agent_id`),
#   PRIMARY KEY (`agent_id`,`community_id`),
# Column types:
#  `agent_id` int(10) unsigned not null
#  `community_id` int(10) unsigned not null
# To remove this duplicate index, execute:
ALTER TABLE `forge`.`erp_agent_community` DROP INDEX `agent_community_agent_id_index`;


# ########################################################################
# forge.erp_agent_ridgepole
# ########################################################################


# agent_ridgepole_agent_id_index is a left-prefix of PRIMARY
# Key definitions:
#   KEY `agent_ridgepole_agent_id_index` (`agent_id`),
#   PRIMARY KEY (`agent_id`,`ridgepole_id`),
# Column types:
#  `agent_id` int(10) unsigned not null
#  `ridgepole_id` int(10) unsigned not null
# To remove this duplicate index, execute:
ALTER TABLE `forge`.`erp_agent_ridgepole` DROP INDEX `agent_ridgepole_agent_id_index`;


# ########################################################################
# forge.erp_city_head_office
# ########################################################################


# city_head_office_city_id_index is a left-prefix of PRIMARY
# Key definitions:
#   KEY `city_head_office_city_id_index` (`city_id`),
#   PRIMARY KEY (`city_id`,`head_office_id`),
# Column types:
#  `city_id` int(10) unsigned not null
#  `head_office_id` int(10) unsigned not null
# To remove this duplicate index, execute:
ALTER TABLE `forge`.`erp_city_head_office` DROP INDEX `city_head_office_city_id_index`;


# ########################################################################
# forge.erp_comments
# ########################################################################


# comments_trace_id_index is a left-prefix of acceptor_type
# Key definitions:
#   KEY `comments_trace_id_index` (`trace_id`),
#   KEY `acceptor_type` (`trace_id`,`acceptor_type`) USING BTREE
# Column types:
#  `trace_id` int(11) not null
#  `acceptor_type` varchar(255) collate utf8_unicode_ci not null
# To remove this duplicate index, execute:
ALTER TABLE `forge`.`erp_comments` DROP INDEX `comments_trace_id_index`;


# ########################################################################
# forge.erp_community_education
# ########################################################################


# community_education_community_id_index is a left-prefix of PRIMARY
# Key definitions:
#   KEY `community_education_community_id_index` (`community_id`),
#   PRIMARY KEY (`community_id`,`education_id`),
# Column types:
#  `community_id` int(10) unsigned not null
#  `education_id` int(10) unsigned not null
# To remove this duplicate index, execute:
ALTER TABLE `forge`.`erp_community_education` DROP INDEX `community_education_community_id_index`;


以上是关于debian8安装percona-toolkit检测mysql的索引和慢查询分析的主要内容,如果未能解决你的问题,请参考以下文章

转 percona-toolkit的安装和使用

percona-toolkit安装

percona-toolkit工具包的安装和初步使用

安装percona-toolkit提示的报错

percona-toolkit工具包安装

安装percona-toolkit.rpm时候报错:perl(Time::HiRes) is needed by percona-toolkit-2.2.16-1.noarch