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. 如何在smarty模板中执行php代码

    Smarty模板主要的目的是分离逻辑层和表现层,所以在模板中不应该包含逻辑部分,逻辑层也不应该含有HTML.要在模板中插入逻辑程序的这种做法"非常"不被推荐,在你的case中. 如 ...

  2. this.options[selectedIndex]的使用

    <select id="sel" onchange="javascript:getSelect();"> <option value=&quo ...

  3. IE浏览器兼容性问题解决方案

    一.CSS常见问题 1.H5标签兼容性 解决方案:<script src="http://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.j ...

  4. 【ubuntu】出现device not managed连接不上网络

    ubuntu安装好后显示“device not managed” 1. 编辑/etc/NetworkManager/NetworkManager.conf: sudo gedit /etc/Netwo ...

  5. (转)Entity Framework4.1实现动态多条件查询、分页和排序

    原文:http://www.cnblogs.com/ahui/archive/2011/08/04/2127282.html EF通用的分页实现: 1 2 3 4 5 6 7 8 9 10 11 12 ...

  6. SpringBoot 项目打包后获取不到resource下资源的解决

    SpringBoot 项目打包后获取不到resource下资源的解决 在项目中有几个文件需要下载,然后不想暴露真实路径,又没有CDN,便决定使用接口的方式来获取文件.最初的时候使用了传统的方法来获取文 ...

  7. Mysql的transaction实现(转)

    (http://www.blogjava.net/i369/archive/2007/04/29/108906.html) transaction在数据库编程中是一个重要的概念,这样做可以控制对数据库 ...

  8. 拖拽事件--select外边框拖拽

    地图上面的搜索框要可拖拽 但是搜索框是有点击事件的,点击显隐下拉菜单,如果拖拽的事件源选择select框的话,会有样式(十字拖动符cursor:move与selelt默认点击的箭头)冲突 思索良久,就 ...

  9. SQL Union和Union All使用方法

    格式: [SQL 语句 1]UNION [SQL 语句 2] 对两个结果集进行并集操作,不包括重复行,同时进行默认规则的排序: select ID,NAME from A UNION select I ...

  10. 解决dubbo的服务发布注解@service不能和事务注解不能共用的方案

    最近在项目的开发中遇到了一个问题,就是服务提供方使用@service发布dubbo服务时候,服务消费方@Reference无法注入bean导致空指针异常的问题.分析原因为@service注解并没有将服 ...