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. java.lang.IllegalStateException: FragmentManager is already executing transactions 及 SmartTabLayout复用

    在复用 SmartTabLayout  时, 出现了标题所示的错误.首先我的场景是Activity下两个fragment  :A 和 B,A中使用了SmarttabLayout和viewpager结合 ...

  2. WebGL 踩坑系列-1

    WebGL 中的一些选项WebGL 中开启颜色混合(透明效果) gl.enable(gl.BLEND); gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALP ...

  3. python方法

    跨模块级(跨文件)的[全局变量的方法] ``` # -*- coding: utf-8 -*- # /modvar.py def _init(): global _module_dict _modul ...

  4. CentOS 搭建Redis4 环境

    下载 wget http://download.redis.io/releases/redis-4.0.10.tar.gz   安装步骤 tar xvf redis-4.0.10.tar.gz mak ...

  5. MVC execl 导入导出

    MVC execl 导入导出 <input id="xls" name="xls" type="file" style="w ...

  6. maven配置好了之后再次开机找不到命令

    问题: 昨天还运行的好好的,今天突然又报错了, mvn不是内部或外部命令,也不是可运行程序或批处理文件 原因: 环境配置问题,windows7和windows10稍微有一点不一样,对照下面配置看哪里不 ...

  7. Python常用模块(四)

    一.re模块 正则表达式时计算机科学的一个概念,正则表达式通常被用来检索,替换那些符合某个模式的文本,大多数程序设计语言都支持利用正则表达式进行字符串操作. 正则就是用一些具有特殊含义的符号组合到一起 ...

  8. 实现AB值对换的两种方法

    package com.smbea.demo.exchange; /** * AB对换 * @author hapday * @2017年1月22日 @上午12:36:24 */ public cla ...

  9. 微信小程序实战篇:基于wxcharts.js绘制移动报表

    前言 微信小程序图表插件(wx-charts)是基于canvas绘制,体积小巧,支持图表类型饼图.线图.柱状图 .区域图等图表图形绘制,目前wx-charts是微信小程序图表插件中比较强大好使的一个. ...

  10. Miner3D 数据分析软件

    现在,越来越多的专业人士愿意选择Miner3D来帮助他们进行快速高效的智能决策,因为它是一个功能强大.专业性强.海量数据存储能力.三维可视化效果逼真的数据分析解决工具.Miner3D凭借出色的图形质量 ...