Preface
 
    There's a common case that we neet to archive amount of records in some tables to a file or another table in different database even delete them directly.Is there a tool can do all these jobs with satisfying way?Surely it is.pt-archiver can help us archiving that various archive jobs.
 
Introduce
 
    pt-archiver is a single tool of Percona-Toolkit suits which is produced by percona company.It provides  flexible way to archive your data in tables.Let's see the detail of it.
 
Procedure
 
  1. ###Download and install Percona-Toolkit###
  2. [root@zlm2 :: ~]wget https://www.percona.com/downloads/percona-toolkit/3.0.10/binary/redhat/7/x86_64/percona-toolkit-3.0.10-1.el7.x86_64.rpm
  3. -- Omitted.
  4. [root@zlm2 :: ~]yum -y localinstall percona-toolkit-3.0.-.el7.x86_64.rpm
  5. -- Omitted.
  6. Installed:
  7. percona-toolkit.x86_64 :3.0.-.el7
  8.  
  9. Dependency Installed:
  10. perl-Compress-Raw-Bzip2.x86_64 :2.061-.el7 perl-Compress-Raw-Zlib.x86_64 :2.061-.el7 perl-DBD-MySQL.x86_64 :4.023-.el7
  11. perl-DBI.x86_64 :1.627-.el7 perl-Data-Dumper.x86_64 :2.145-.el7 perl-Digest.noarch :1.17-.el7
  12. perl-Digest-MD5.x86_64 :2.52-.el7 perl-IO-Compress.noarch :2.061-.el7 perl-IO-Socket-IP.noarch :0.21-.el7
  13. perl-IO-Socket-SSL.noarch :1.94-.el7 perl-Mozilla-CA.noarch :-.el7 perl-Net-Daemon.noarch :0.48-.el7
  14. perl-Net-LibIDN.x86_64 :0.12-.el7 perl-Net-SSLeay.x86_64 :1.55-.el7 perl-PlRPC.noarch :0.2020-.el7
  15. perl-TermReadKey.x86_64 :2.30-.el7
  16.  
  17. Complete!
  18.  
  19. ###After install the Percona-Toolkit,you can check all the tools it contains by command below:###
  20. [root@zlm2 :: ~]man percona-tookit
  21. TOOLS
  22. This release of Percona Toolkit includes the following tools:
  23.  
  24. pt-align
  25. Align output from other tools to columns.
  26.  
  27. pt-archiver
  28. Archive rows from a MySQL table into another table or a file.
  29.  
  30. pt-config-diff
  31. Diff MySQL configuration files and server variables.
  32.  
  33. pt-deadlock-logger
  34. Log MySQL deadlocks.
  35.  
  36. pt-diskstats
  37. An interactive I/O monitoring tool for GNU/Linux.
  38.  
  39. pt-duplicate-key-checker
  40. Find duplicate indexes and foreign keys on MySQL tables.
  41.  
  42. pt-fifo-split
  43. Split files and pipe lines to a fifo without really splitting.
  44.  
  45. pt-find
  46. Find MySQL tables and execute actions, like GNU find.
  47.  
  48. pt-fingerprint
  49. Convert queries into fingerprints.
  50.  
  51. pt-fk-error-logger
  52. Log MySQL foreign key errors.
  53.  
  54. pt-heartbeat
  55. Monitor MySQL replication delay.
  56.  
  57. pt-index-usage
  58. Read queries from a log and analyze how they use indexes.
  59.  
  60. pt-ioprofile
  61. Watch process IO and print a table of file and I/O activity.
  62.  
  63. pt-kill
  64. Kill MySQL queries that match certain criteria.
  65.  
  66. pt-mext
  67. Look at many samples of MySQL "SHOW GLOBAL STATUS" side-by-side.
  68.  
  69. pt-mysql-summary
  70. Summarize MySQL information nicely.
  71.  
  72. pt-online-schema-change
  73. ALTER tables without locking them.
  74.  
  75. pt-pmp
  76. Aggregate GDB stack traces for a selected program.
  77.  
  78. pt-query-digest
  79. Analyze MySQL queries from logs, processlist, and tcpdump.
  80.  
  81. pt-show-grants
  82. Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them.
  83.  
  84. pt-sift
  85. Browses files created by pt-stalk.
  86.  
  87. pt-slave-delay
  88. Make a MySQL slave server lag behind its master.
  89.  
  90. pt-slave-find
  91. Find and print replication hierarchy tree of MySQL slaves.
  92.  
  93. pt-slave-restart
  94. Watch and restart MySQL replication after errors.
  95.  
  96. pt-stalk
  97. Collect forensic data about MySQL when problems occur.
  98.  
  99. pt-summary
  100. Summarize system information nicely.
  101.  
  102. pt-table-checksum
  103. Verify MySQL replication integrity.
  104.  
  105. pt-table-sync
  106. Synchronize MySQL table data efficiently.
  107.  
  108. pt-table-usage
  109. Analyze how queries use tables.
  110.  
  111. pt-upgrade
  112. Verify that query results are identical on different servers.
  113.  
  114. pt-variable-advisor
  115. Analyze MySQL variables and advise on possible problems.
  116.  
  117. pt-visual-explain
  118. Format EXPLAIN output as a tree.
  119.  
  120. ###See the parameter of pt-archiver.###
  121. [root@zlm2 :: ~]#pt-archiver --help
  122. -- Omitted.
  123.  
  124. ###Parameters demonstration.###
  125. Indispensible parameter:
  126. --source [-h|-S] -u -P -D -A
  127.  
  128. Choose only one below:
  129. --dest=d -- Usually be used to archive records to another table(can be different instance).
  130. --purge -- Usually be used to purge records instead of archive them.
  131. --file=s -- Usually be used to archive records into a file.
  132.  
  133. Performance ralevant:
  134. --analyze=s -- Run analyze table after archive.
  135. --optimize=s -- Run optimize table after archive.
  136. --ascend-first -- Ascend just first column of index.
  137. --buffer -- Buffer output to file and flush when commit.
  138. --bulk-delete -- Delete by chunk.
  139. --bulk-insert -- Insert by chunk.
  140. --limit=i -- Rows of per statment when arching,default .
  141. --txn-size=i -- Rows of per trx,default .
  142. --primary-key-only -- Merely use primary key.
  143.  
  144. Infermation output:
  145. --progress=i -- Print per i rows.
  146. --statistics -- Print time statistics.
  147.  
  148. Others parameters:
  149. --dry-run -- Just print queries without real doing.
  150. --retries=i -- Times of when retry,default .
  151. --no-delete -- Specify not to delete archived records in source table.
  152.  
  153. ###Take care the rules when specify parameters.###
  154. Specify at least one of --dest, --file, or --purge. -- There're three mode of achive behavior.
  155. --ignore and --replace are mutually exclusive.
  156. --txn-size and --commit-each are mutually exclusive. -- Usually I'd rather use "txn-size" to specify the timing of commit depending amount of transactions.
  157. --low-priority-insert and --delayed-insert are mutually exclusive.
  158. --share-lock and --for-update are mutually exclusive.
  159. --analyze and --optimize are mutually exclusive. -- I don't recommend use "analyze" or "optimize" when archive tables simultaneously,but afterward does when business not busy.
  160. --no-ascend and --no-delete are mutually exclusive.
  161. DSN values in --dest default to values from --source if COPY is yes.
Summary
  • pt-achiver is useful when archive your records of big tables.
  • Make sure that your table has index key on it.Otherwise,it will lead to bad performance when archive.
  • Plz distinguish these two parameter —— "no-delete"&"purge",they are differently used.
  • More testing is necessary to make out the performance influenced by different parameter.

Percona-Toolkit工具包之pt-archiver的更多相关文章

  1. Percona Toolkit mysql辅助利器

    1 PT介绍 Percona Toolkit简称pt工具—PT-Tools,是Percona公司开发用于管理MySQL的工具,功能包括检查主从复制的数据一致性.检查重复索引.定位IO占用高的表文件.在 ...

  2. Percona Toolkit工具使用

    Percona Toolkit简称pt工具-PT-Tools,是Percona公司开发用于管理MySQL的工具,功能包括检查主从复制的数据一致性.检查重复索引.定位IO占用高的表文件.在线DDL等 下 ...

  3. Centos 安装Percona Toolkit工具集

    1.下载 下载地址:   https://www.percona.com/downloads/percona-toolkit/LATEST/ [root@bogon ~]# wget https:// ...

  4. RDS for MySQL 如何使用 Percona Toolkit

    Percona Toolkit 包含多种用于 MySQL 数据库管理的工具. 下面介绍常用的 pt-online-schema-change  和  pt-archiver 搭配 RDS MySQL ...

  5. Percona Toolkit工具集介绍

    部署mysql工具是一个非常重要的部分,所以工具的可靠性和很好的设计非常重要.percona toolkit是一个有30多个mysql工具的工具箱.兼容mysql,percona server,mar ...

  6. Want to archive tables? Use Percona Toolkit’s pt-archiver--转载

    原文地址:https://www.percona.com/blog/2013/08/12/want-to-archive-tables-use-pt-archiver/ Percona Toolkit ...

  7. Percona Toolkit工具连接MySQL 8报错的解决方案

    使用Percona Toolkit的工具连接MySQL 8.x数据库时,会遇到类似"failed: Plugin caching_sha2_password could not be loa ...

  8. Percona Toolkit 使用

    安装 percona-toolkit perl Makefile.PL make make test make install 默认安装到 /usr/local/bin 目录下 可能需要 DBI-1. ...

  9. 使用Percona Toolkit解决Mysql主从不同步问题【备忘】

    由于各种原因,mysql主从架构经常会出现数据不一致的情况出现,大致归结为如下几类 1:备库写数据 2:执行non-deterministic query 3:回滚掺杂事务表和非事务表的事务 4:bi ...

  10. Percona Toolkit 2.2.19 is now available

    New Features: 1221372: pt-online-schema-change now aborts with an error if the server is a slave, be ...

随机推荐

  1. Oracle 数据库异机恢复(归档模式)

    操作必须在服务器上进行(在192.168.12.71上执行) 0.按需要恢复的日期,把距恢复日期最近的全部备份和全部备份日期后的日志备份一同拷贝到需要恢复的机器上: 1.用RMAN登陆 C:\User ...

  2. 文件上传fileupload文件接收

    form表单提交数据到servlet后,使用fileupload进行接收. fileupload 是由 apache 的 commons 组件提供的上传组件.它最主要的工作就是帮我们解析 reques ...

  3. 简谈 Java 中的泛型通配符

    很好的一篇文章https://zhuanlan.zhihu.com/p/26681625

  4. SQL Server ->> 生成代码把表字段从NULL改为NOT NULL

    一般我们用SELECT .... INTO语句生成的表字段都是允许为NULL.而如果我们需要改成NOT NULL呢 select 'ALTER TABLE dbo.XXXXXXX ALTER COLU ...

  5. Java反射创建带构造参数的类 并执行方法

    部分代码 public void go(ServletRequest request,ServletResponse response){ String methodName = "inde ...

  6. 在centos7中安装redis,并通过node.js操作redis

    引言 最近在学习node.js 连接redis的模块,所以尝试了一下在虚拟机中安装cent OS7,并安装redis,并使用node.js 操作redis.所以顺便做个笔记. 如有不对的地方,欢迎大家 ...

  7. June 12th 2017 Week 24th Monday

    All the splendor in the world is not worth a good friend. 人世间所有的荣华富贵都比不上有一个好朋友. It's great to have a ...

  8. 一点一点学写Makefile(2)-自动搜所当前目录下的所有源文件

    上个博客我们使用的是笨方法添加源文件,本次我要实现的是遍历文件夹来获得所有的cpp文件 //makefile CROSS = CC = $(CROSS)gcc CXX = $(CROSS)g++ DE ...

  9. Kubernetes stateful set讲解以及一个基于postgreSQL的具体例子

    Stateful Set是Kubernetes 1.9版本新引入的一个概念,用于管理有状态的应用. Kubernetes官方文档: https://kubernetes.io/docs/concept ...

  10. C语言 条件编译(if )

    #include <stdio.h> #define NUM -1 int main(int argc, const char * argv[]) { #if NUM > 0 pri ...