首页 > 代码库 > pt(Percona Toolkit)工具详解:(一)安装
pt(Percona Toolkit)工具详解:(一)安装
pt(Percona Toolkit)工具是由Percona公司开发的一个用perl语言编写的工具集,包含很多功能,例如在线更改数据表结构,校验主从数据,检查数据库状态,分析慢查询等这些靠人手做起来比较麻烦的事情,功能强大,操作简单.
安装
既然是perl语言开发的工具集,那当然是先安装perl相关依赖包了
yum install -y perl perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes perl-Digest-MD5
然后,就到下面这个连接下载最新版的吧,暂时都是linux版本,没有windows的
https://www.percona.com/downloads/percona-toolkit/
或者在linux系统下下载安装:
#先下载Percona Toolkit工具编译包 wget "https://www.percona.com/downloads/percona-toolkit/2.2.20/tarball/percona-toolkit-2.2.20.tar.gz" #解压 tar xf percona-toolkit-2.2.20.tar.gz #进入目录安装 cd percona-toolkit-2.2.20.tar.gz #开始编译安装 perl Makefile.PL make make install #安装完了就有命令了 ll /usr/local/bin/pt-* -r-xr-xr-x 1 root root 41480 Jan 19 11:03 /usr/local/bin/pt-align -r-xr-xr-x 1 root root 263438 Jan 19 11:03 /usr/local/bin/pt-archiver -r-xr-xr-x 1 root root 168985 Jan 19 11:03 /usr/local/bin/pt-config-diff -r-xr-xr-x 1 root root 166210 Jan 19 11:03 /usr/local/bin/pt-deadlock-logger -r-xr-xr-x 1 root root 164927 Jan 19 11:03 /usr/local/bin/pt-diskstats -r-xr-xr-x 1 root root 168895 Jan 19 11:03 /usr/local/bin/pt-duplicate-key-checker -r-xr-xr-x 1 root root 49890 Jan 19 11:03 /usr/local/bin/pt-fifo-split -r-xr-xr-x 1 root root 149727 Jan 19 11:03 /usr/local/bin/pt-find -r-xr-xr-x 1 root root 67037 Jan 19 11:03 /usr/local/bin/pt-fingerprint -r-xr-xr-x 1 root root 133187 Jan 19 11:03 /usr/local/bin/pt-fk-error-logger -r-xr-xr-x 1 root root 218381 Jan 19 11:03 /usr/local/bin/pt-heartbeat -r-xr-xr-x 1 root root 226009 Jan 19 11:03 /usr/local/bin/pt-index-usage -r-xr-xr-x 1 root root 32345 Jan 19 11:03 /usr/local/bin/pt-ioprofile -r-xr-xr-x 1 root root 250059 Jan 19 11:03 /usr/local/bin/pt-kill -r-xr-xr-x 1 root root 21753 Jan 19 11:03 /usr/local/bin/pt-mext -r-xr-xr-x 1 root root 102147 Jan 19 11:03 /usr/local/bin/pt-mysql-summary -r-xr-xr-x 1 root root 393892 Jan 19 11:03 /usr/local/bin/pt-online-schema-change -r-xr-xr-x 1 root root 24594 Jan 19 11:03 /usr/local/bin/pt-pmp -r-xr-xr-x 1 root root 520502 Jan 19 11:03 /usr/local/bin/pt-query-digest -r-xr-xr-x 1 root root 75713 Jan 19 11:03 /usr/local/bin/pt-show-grants -r-xr-xr-x 1 root root 37724 Jan 19 11:03 /usr/local/bin/pt-sift -r-xr-xr-x 1 root root 145553 Jan 19 11:03 /usr/local/bin/pt-slave-delay -r-xr-xr-x 1 root root 128910 Jan 19 11:03 /usr/local/bin/pt-slave-find -r-xr-xr-x 1 root root 181316 Jan 19 11:03 /usr/local/bin/pt-slave-restart -r-xr-xr-x 1 root root 69580 Jan 19 11:03 /usr/local/bin/pt-stalk -r-xr-xr-x 1 root root 90418 Jan 19 11:03 /usr/local/bin/pt-summary -r-xr-xr-x 1 root root 422772 Jan 19 11:03 /usr/local/bin/pt-table-checksum -r-xr-xr-x 1 root root 398202 Jan 19 11:03 /usr/local/bin/pt-table-sync -r-xr-xr-x 1 root root 246864 Jan 19 11:03 /usr/local/bin/pt-table-usage -r-xr-xr-x 1 root root 330806 Jan 19 11:03 /usr/local/bin/pt-upgrade -r-xr-xr-x 1 root root 177020 Jan 19 11:03 /usr/local/bin/pt-variable-advisor -r-xr-xr-x 1 root root 102278 Jan 19 11:03 /usr/local/bin/pt-visual-explain
这样就算安装完毕了,很简单.
随便搞个简单的来测试下.
#mysql服务状态摘要 pt-mysql-summary --user=root --password=‘123‘ mysql: [Warning] Using a password on the command line interface can be insecure. # Percona Toolkit MySQL Summary Report ####################### System time | 2017-01-19 10:48:39 UTC (local TZ: CST +0800) # Instances ################################################## Port Data Directory Nice OOM Socket ===== ========================== ==== === ====== 3306 /data/mysql/data 0 0 /tmp/mysql.sock # MySQL Executable ########################################### Path to executable | /usr/local/Percona-Server-5.7.15-9-Linux.x86_64.ssl101/bin/mysqld Has symbols | Yes # Report On Port 3306 ######################################## User | root@% Time | 2017-01-19 18:48:39 (CST) Hostname | beifen1 Version | 5.7.15-9-log Percona Server (GPL), Release 9, Revision 9f0fd0a Built On | Linux x86_64 Started | 2017-01-18 16:07 (up 1+02:41:11) Databases | 8 Datadir | /data/mysql/data/ Processes | 6 connected, 1 running Replication | Is a slave, has 0 slaves connected Pidfile | /data/mysql/data/beifen1.pid (exists) # Processlist ################################################ . . . . 省略一长串
ok,正常,其他功能请看下一篇
pt(Percona Toolkit)工具详解:(一)安装
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。