博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pt(Percona Toolkit)工具安装
阅读量:5923 次
发布时间:2019-06-19

本文共 4348 字,大约阅读时间需要 14 分钟。

  pt(Percona Toolkit)工具安装

一.pt(Percona Toolkit)工具是由Percona公司开发的一个用perl语言编写的工具集,包含很多功能,例如在线更改数据表结构,校验主从数据,检查数据库状态,分析慢查询等这些靠人手做起来比较麻烦的事情,功能强大,操作简单

二.安装依赖包

yum install -y perl perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes perl-Digest-MD5 perl-ExtUtils-MakeMaker

下载Percona Toolkit工具编译包

 

[root@node1 ~]# wget "https://www.percona.com/downloads/percona-toolkit/3.0.3/binary/tarball/percona-toolkit-3.0.3_x86_64.tar.gz"

解压

 

[root@node1 ~]# tar xf percona-toolkit-3.0.3_x86_64.tar.gz

进入目录安装

[root@node1 ~]# cd percona-toolkit-3.0.3

开始编译安装

[root@node1 percona-toolkit-3.0.3]# perl Makefile.PL

[root@node1 percona-toolkit-3.0.3]# make

[root@node1 percona-toolkit-3.0.3]# make install

就显示出一些常用的pt命令

[root@node1 ~]# ll /usr/local/bin/pt-*

-r-xr-xr-x 1 root root   41753 Oct  2 22:02 /usr/local/bin/pt-align

-r-xr-xr-x 1 root root  264365 Oct  2 22:02 /usr/local/bin/pt-archiver

-r-xr-xr-x 1 root root  169286 Oct  2 22:02 /usr/local/bin/pt-config-diff

-r-xr-xr-x 1 root root  166482 Oct  2 22:02 /usr/local/bin/pt-deadlock-logger

-r-xr-xr-x 1 root root  165199 Oct  2 22:02 /usr/local/bin/pt-diskstats

-r-xr-xr-x 1 root root  169478 Oct  2 22:02 /usr/local/bin/pt-duplicate-key-checker

-r-xr-xr-x 1 root root   50163 Oct  2 22:02 /usr/local/bin/pt-fifo-split

-r-xr-xr-x 1 root root  149999 Oct  2 22:02 /usr/local/bin/pt-find

-r-xr-xr-x 1 root root   67310 Oct  2 22:02 /usr/local/bin/pt-fingerprint

-r-xr-xr-x 1 root root  133459 Oct  2 22:02 /usr/local/bin/pt-fk-error-logger

-r-xr-xr-x 1 root root  219308 Oct  2 22:02 /usr/local/bin/pt-heartbeat

-r-xr-xr-x 1 root root  226592 Oct  2 22:02 /usr/local/bin/pt-index-usage

-r-xr-xr-x 1 root root   32411 Oct  2 22:02 /usr/local/bin/pt-ioprofile

-r-xr-xr-x 1 root root  250986 Oct  2 22:02 /usr/local/bin/pt-kill

-r-xr-xr-x 1 root root   21876 Oct  2 22:02 /usr/local/bin/pt-mext

-r-xr-xr-x 1 root root 6402784 Oct  2 22:02 /usr/local/bin/pt-mongodb-query-digest

-r-xr-xr-x 1 root root 6596000 Oct  2 22:02 /usr/local/bin/pt-mongodb-summary

-r-xr-xr-x 1 root root  102146 Oct  2 22:02 /usr/local/bin/pt-mysql-summary

-r-xr-xr-x 1 root root  399567 Oct  2 22:02 /usr/local/bin/pt-online-schema-change

-r-xr-xr-x 1 root root   24660 Oct  2 22:02 /usr/local/bin/pt-pmp

-r-xr-xr-x 1 root root  521606 Oct  2 22:02 /usr/local/bin/pt-query-digest

-r-xr-xr-x 1 root root   75986 Oct  2 22:02 /usr/local/bin/pt-show-grants

-r-xr-xr-x 1 root root   37790 Oct  2 22:02 /usr/local/bin/pt-sift

-r-xr-xr-x 1 root root  145825 Oct  2 22:02 /usr/local/bin/pt-slave-delay

-r-xr-xr-x 1 root root  129838 Oct  2 22:02 /usr/local/bin/pt-slave-find

-r-xr-xr-x 1 root root  182243 Oct  2 22:02 /usr/local/bin/pt-slave-restart

-r-xr-xr-x 1 root root   73082 Oct  2 22:02 /usr/local/bin/pt-stalk

-r-xr-xr-x 1 root root   90795 Oct  2 22:02 /usr/local/bin/pt-summary

-r-xr-xr-x 1 root root  424922 Oct  2 22:02 /usr/local/bin/pt-table-checksum

-r-xr-xr-x 1 root root  399440 Oct  2 22:02 /usr/local/bin/pt-table-sync

-r-xr-xr-x 1 root root  247137 Oct  2 22:02 /usr/local/bin/pt-table-usage

-r-xr-xr-x 1 root root  331255 Oct  2 22:02 /usr/local/bin/pt-upgrade

-r-xr-xr-x 1 root root  177292 Oct  2 22:02 /usr/local/bin/pt-variable-advisor

-r-xr-xr-x 1 root root  102551 Oct  2 22:02 /usr/local/bin/pt-visual-explain

 

这样就算安装完毕了,很简单.

搞个测试,MySQL服务状态显示:

 

[root@node1 ~]# pt-mysql-summary --user=root --password='abc123'

mysql: [Warning] Using a password on the command line interface can be insecure.

# Percona Toolkit MySQL Summary Report #######################

              System time | 2017-10-03 05:03:34 UTC (local TZ: PDT -0700)

# Instances ##################################################

  Port  Data Directory             Nice OOM Socket

  ===== ========================== ==== === ======

        /var/lib/mysql             0    0   /var/lib/mysql/mysql.sock

# MySQL Executable ###########################################

       Path to executable | /usr/sbin/mysqld

              Has symbols | Yes

# Report On Port 3306 ########################################

                     User | root@localhost

                     Time | 2017-10-02 22:03:34 (PDT)

                 Hostname | node1

                  Version | 5.7.19-log MySQL Community Server (GPL)

                 Built On | Linux x86_64

                  Started | 2017-10-02 03:48 (up 0+18:15:33)

                Databases | 8

                  Datadir | /var/lib/mysql/

                Processes | 1 connected, 1 running

              Replication | Is not a slave, has 0 slaves connected

                  Pidfile | /var/run/mysqld/mysqld.pid (exists)

# Processlist ################################################

后面一大串,在此省略,测试正常运行。

本文转自去轻狂书生51CTO博客,原文链接:http://blog.51cto.com/8999a/1970303 ,如需转载请自行联系原作者

你可能感兴趣的文章
第 4 章 gulpjs
查看>>
3.4. IP Address
查看>>
Flex builder的调试时需要flash player debug版本
查看>>
Ubuntu 中启用 root 帐号
查看>>
a2sd+状态下应用程序丢失的解决办法
查看>>
F#初试(2)
查看>>
基于WF4 Workflow Service实现简单审批流程(上)
查看>>
杭州互联网公司汇总
查看>>
数据结构复习笔记(3)
查看>>
基于事件驱动的DDD领域驱动设计框架分享(附源代码)
查看>>
7.5。Outlook smime x509证书
查看>>
51Nod 1289 大鱼吃小鱼(模拟,经典好题)
查看>>
【Android疑难杂症】GridView动态设置Item的宽高导致第一个Item不响应或显示不正常的问题...
查看>>
一个线程封装类
查看>>
贪心算法
查看>>
把JScript函数模拟为"异步执行"方式
查看>>
7.13. rename file
查看>>
(第二天)原型、继承
查看>>
activiti bpmnModel使用
查看>>
《剑指offer》青蛙跳台阶
查看>>