Preface
 
    We are always obliged to analyze many outputs generated by various tools directly even in flat text files in server performance diagnosis.Further more,we need to compare the differences depend on these results such as the output of "mysqladmin" tool.
 
Introduce
 
    pt-mext is tht very tool which can help you to accomplish the work mentioned above easily.It can execute the command which you specify then print the result side-by-side in one line.Not only can it print results from a running program but also can it print results from a flat text file.
 
Procedure
 
Usage
 pt-mext [OPTIONS] -- COMMAND
Common Parameters
 --relative //Each column substracts the value of the column before it.
Example
 
Collect the global status of MySQL with 1s interval and 3 times in all by mysqladmin.
 [root@zlm2 :: ~]
#mysqladmin ext -i1 -c3 > mysqladmin.log [root@zlm2 :: ~]
#ls -l
total
-rw-------. root root Jul anaconda-ks.cfg
-rwxr-xr-x root root Jun : mysql-5.7.-linux-glibc2.-x86_64.tar
-rw-r--r-- root root Jul : mysqladmin.log
-rwxr-xr-x root root Jun : mysqld.sh
-rwxr-xr-x root root Jun : percona-toolkit-3.0.-.el7.x86_64.rpm
drwxr-xr-x root root Jul : sysbench-1.0
The "mysqladmin.log" file contains all the output of the three times individually.
 [root@zlm2 :: ~]
#cat mysqladmin.log
+-----------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+-----------------------------------------------+--------------------------------------------------+
| Aborted_clients | |
| Aborted_connects | |
| Binlog_cache_disk_use | |
| Binlog_cache_use | |
| Binlog_stmt_cache_disk_use | |
| Binlog_stmt_cache_use | |
| Bytes_received | |
| Bytes_sent | |
| Com_admin_commands | |
| Com_assign_to_keycache | |
| Com_alter_db | |
| Com_alter_db_upgrade | |
... +-----------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+-----------------------------------------------+--------------------------------------------------+
| Aborted_clients | |
| Aborted_connects | |
| Binlog_cache_disk_use | |
| Binlog_cache_use | |
| Binlog_stmt_cache_disk_use | |
| Binlog_stmt_cache_use | |
| Bytes_received | |
| Bytes_sent | |
| Com_admin_commands | |
| Com_assign_to_keycache | |
| Com_alter_db | |
| Com_alter_db_upgrade | |
... +-----------------------------------------------+--------------------------------------------------+
| Variable_name | Value |
+-----------------------------------------------+--------------------------------------------------+
| Aborted_clients | |
| Aborted_connects | |
| Binlog_cache_disk_use | |
| Binlog_cache_use | |
| Binlog_stmt_cache_disk_use | |
| Binlog_stmt_cache_use | |
| Bytes_received | |
| Bytes_sent | |
| Com_admin_commands | |
| Com_assign_to_keycache | |
| Com_alter_db | |
| Com_alter_db_upgrade | |
Execute pt-mext to print them again with the "mysqladmin.log" file.
 [root@zlm2 :: ~]
#pt-mext -- cat mysqladmin.log
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Binlog_stmt_cache_disk_use
Binlog_stmt_cache_use
Bytes_received
Bytes_sent
Com_admin_commands
Com_alter_db
Com_alter_db_upgrade
... //pt-mext arranges the results of those three times side-by-side and print them.
//The first column shows the first collected result and the second column shows the second one.
//The number of columns is n-1(n is the collection times here).
Specify the "--relative" option to get the differential data.
 [root@zlm2 :: ~]
#pt-mext --relative -- cat mysqladmin.log
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Binlog_stmt_cache_disk_use
Binlog_stmt_cache_use
Bytes_received //2277-2142=35
Bytes_sent //165275-155447=9828
Com_admin_commands
Com_alter_db
Com_alter_db_upgrade //Differential data is more distinct for us to know about the variation of performance.
//Even though we use "--relative" option,there're still two columns here.
Execute pt-mext without flat text file.
 [root@zlm2 :: ~]
#pt-mext -r -- mysqladmin ext -i1 -c3
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Binlog_stmt_cache_disk_use
Binlog_stmt_cache_use
Bytes_received
Bytes_sent
Com_admin_commands
Com_alter_db
Com_alter_db_upgrade
... [root@zlm2 :: ~]
#pt-mext -- mysqladmin ext -i1 -c3
Aborted_clients
Aborted_connects
Binlog_cache_disk_use
Binlog_cache_use
Binlog_stmt_cache_disk_use
Binlog_stmt_cache_use
Bytes_received
Bytes_sent
Com_admin_commands
Com_alter_db
Com_alter_db_upgrade
...
Summary
  • pt-mext has only three options and it is rather easy to use.
  • pt-mext is a useful tool in anaylzing differential data of global status of  MySQL.
  • pt-mext can be used not not only in "mysqladmin" program but also others.
 

Percona-Tookit工具包之pt-mext的更多相关文章

  1. Linux后台开发工具箱

    https://files-cdn.cnblogs.com/files/aquester/Linux后台开发工具箱.pdf 目录 目录 1 1. 前言 3 2. 脚本类工具 3 2.1. sed命令- ...

  2. Mysql: pt-table-checksum 和 pt-table-sync 检查主从一致性,实验过程

    一.安装 percona 包 1.安装仓库的包 https://www.percona.com/doc/percona-repo-config/yum-repo.html sudo yum insta ...

  3. Linux后台开发工具箱-葵花宝典

    Linux后台开发工具箱-葵花宝典 一见 2016/11/4 目录 目录 1 1. 前言 4 2. 脚本类工具 4 2.1. 双引号和单引号 4 2.2. 取脚本完整文件路径 5 2.3. 环境变量和 ...

  4. 推荐几款MySQL相关工具

    前言: 随着互联网技术的不断发展, MySQL 相关生态也越来越完善,越来越多的工具涌现出来.一些公司或个人纷纷开源出一些不错的工具,本篇文章主要介绍几款 MySQL 相关实用工具.提醒下,这里并不介 ...

  5. [知识库分享系列] 二、.NET(ASP.NET)

    最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...

  6. SQL慢查询安装过程

    SQL慢查询 基本操作 打开防火墙 firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd --reload 安 ...

  7. 快速安装Percona pt工具

    yum install perl-DBI perl-DBD-MySQL perl-Time-HiRes perl-Time-HiRes perl-IO-Socket-SSLwget http://pk ...

  8. Percona 工具包 pt-online-schema-change 简介

    mysql的在线表结构修改,因为低效和阻塞读写.一直被诟病.至于ALTER TABLE 的原理,参看我上一篇文章.MySQL在线修改大表结构.看完后,发现的问题是还是会锁的,且对于在线更新的这块也是不 ...

  9. 安装percona工具包

    1.安装percona源 sudo yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona- ...

  10. percona pt toolkit 总结

    ##=====================================================##pt-osc之工作流程:1.检查更改表是否有主键或唯一索引,是否有触发器2.检查修改表 ...

随机推荐

  1. eureka 源码

    本文为eureka学习笔记,错误之处请指正. ----------------------------------------------------------- 1.服务生产者是怎么注册到配置中心 ...

  2. 【转】Android Canvas绘图详解

    转自:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2012/1212/703.html Android中使用图形处理引擎,2D部分是an ...

  3. jquery拖拽排序,针对后台列表table进行拖拽排序(超实用!)

    现在很多后台列表为了方便均使用拖拽排序的功能,对列表进行随意的排序. 话不多说 ,我在网上找了一些demo,经过对比,现在把方便实用的一个demo列出来,基于jqueryUI.js 先上html代码, ...

  4. Python built-in 函数

    一.abs(x) 说明:返回绝对值 参数可以是:负数.正数.浮点数或者长整形 实例: abs(-1.2) #返回 1.2 abs(1.2) #返回 1.2 abs(-11216.5) #返回 1121 ...

  5. ztree树形图自定义图标在jeecg框架中不显示

    有时候工作遇到问题,就会硬着头皮去解决,今天给大家说一个ztree树形图自定义图标在jeecg框架中不显示的解决方法 对于这个问题,官方观法说法是在节点元素中加入icon的字段,然后后跟图标的url, ...

  6. formvalidator插件

    一.引用jquery 二.引用formValidator.js //================================================================== ...

  7. Static 用法

    1.Static关键字含意:static译文是静态的,静止的,因此使用 static 修饰符声明属于类型本身而不是属于特定对象(new创建的对象)的静态成员. 2.修饰使用范围 static 修饰符可 ...

  8. Tomcat 中部署 web 应用 ---- Dubbo 服务消费者 Web 应用 war 包的部署

    使用Maven构建Dubbo服务的可执行jar包 Dubbo服务的运行方式: 1.使用Servlet容器运行(Tomcat.Jetty等)----不可取 缺点:增加复杂性(端口.管理) 浪费资源(内存 ...

  9. Java 开发小常识

    从理论上来讲Java做的系统并不比其他语言开发出来的系统更占用内存,那么为什么却有这么多理由来证明它确实占内存呢?两个字,陋习. 1.别用new Boolean().在很多场景中Boolean类型是必 ...

  10. CentOS6.5安装Jenkins

    环境: Jenkins官网选择对应的操作系统,会有相应操作系统的安装方法. 我选择的是CentOS系统. 安装Jenkins: sudo wget -O /etc/yum.repos.d/jenkin ...