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
 
 ###Download and install Percona-Toolkit###
[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
-- Omitted.
[root@zlm2 :: ~]yum -y localinstall percona-toolkit-3.0.-.el7.x86_64.rpm
-- Omitted.
Installed:
percona-toolkit.x86_64 :3.0.-.el7 Dependency Installed:
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
perl-DBI.x86_64 :1.627-.el7 perl-Data-Dumper.x86_64 :2.145-.el7 perl-Digest.noarch :1.17-.el7
perl-Digest-MD5.x86_64 :2.52-.el7 perl-IO-Compress.noarch :2.061-.el7 perl-IO-Socket-IP.noarch :0.21-.el7
perl-IO-Socket-SSL.noarch :1.94-.el7 perl-Mozilla-CA.noarch :-.el7 perl-Net-Daemon.noarch :0.48-.el7
perl-Net-LibIDN.x86_64 :0.12-.el7 perl-Net-SSLeay.x86_64 :1.55-.el7 perl-PlRPC.noarch :0.2020-.el7
perl-TermReadKey.x86_64 :2.30-.el7 Complete! ###After install the Percona-Toolkit,you can check all the tools it contains by command below:###
[root@zlm2 :: ~]man percona-tookit
TOOLS
This release of Percona Toolkit includes the following tools: pt-align
Align output from other tools to columns. pt-archiver
Archive rows from a MySQL table into another table or a file. pt-config-diff
Diff MySQL configuration files and server variables. pt-deadlock-logger
Log MySQL deadlocks. pt-diskstats
An interactive I/O monitoring tool for GNU/Linux. pt-duplicate-key-checker
Find duplicate indexes and foreign keys on MySQL tables. pt-fifo-split
Split files and pipe lines to a fifo without really splitting. pt-find
Find MySQL tables and execute actions, like GNU find. pt-fingerprint
Convert queries into fingerprints. pt-fk-error-logger
Log MySQL foreign key errors. pt-heartbeat
Monitor MySQL replication delay. pt-index-usage
Read queries from a log and analyze how they use indexes. pt-ioprofile
Watch process IO and print a table of file and I/O activity. pt-kill
Kill MySQL queries that match certain criteria. pt-mext
Look at many samples of MySQL "SHOW GLOBAL STATUS" side-by-side. pt-mysql-summary
Summarize MySQL information nicely. pt-online-schema-change
ALTER tables without locking them. pt-pmp
Aggregate GDB stack traces for a selected program. pt-query-digest
Analyze MySQL queries from logs, processlist, and tcpdump. pt-show-grants
Canonicalize and print MySQL grants so you can effectively replicate, compare and version-control them. pt-sift
Browses files created by pt-stalk. pt-slave-delay
Make a MySQL slave server lag behind its master. pt-slave-find
Find and print replication hierarchy tree of MySQL slaves. pt-slave-restart
Watch and restart MySQL replication after errors. pt-stalk
Collect forensic data about MySQL when problems occur. pt-summary
Summarize system information nicely. pt-table-checksum
Verify MySQL replication integrity. pt-table-sync
Synchronize MySQL table data efficiently. pt-table-usage
Analyze how queries use tables. pt-upgrade
Verify that query results are identical on different servers. pt-variable-advisor
Analyze MySQL variables and advise on possible problems. pt-visual-explain
Format EXPLAIN output as a tree. ###See the parameter of pt-archiver.###
[root@zlm2 :: ~]#pt-archiver --help
-- Omitted. ###Parameters demonstration.###
Indispensible parameter:
--source [-h|-S] -u -P -D -A Choose only one below:
--dest=d -- Usually be used to archive records to another table(can be different instance).
--purge -- Usually be used to purge records instead of archive them.
--file=s -- Usually be used to archive records into a file. Performance ralevant:
--analyze=s -- Run analyze table after archive.
--optimize=s -- Run optimize table after archive.
--ascend-first -- Ascend just first column of index.
--buffer -- Buffer output to file and flush when commit.
--bulk-delete -- Delete by chunk.
--bulk-insert -- Insert by chunk.
--limit=i -- Rows of per statment when arching,default .
--txn-size=i -- Rows of per trx,default .
--primary-key-only -- Merely use primary key. Infermation output:
--progress=i -- Print per i rows.
--statistics -- Print time statistics. Others parameters:
--dry-run -- Just print queries without real doing.
--retries=i -- Times of when retry,default .
--no-delete -- Specify not to delete archived records in source table. ###Take care the rules when specify parameters.###
Specify at least one of --dest, --file, or --purge. -- There're three mode of achive behavior.
--ignore and --replace are mutually exclusive.
--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.
--low-priority-insert and --delayed-insert are mutually exclusive.
--share-lock and --for-update are mutually exclusive.
--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.
--no-ascend and --no-delete are mutually exclusive.
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. 04_Redis数据类型(set、zset)

    [set:集合类型(高中的集合知识)] 集合类型:无序.不可重复 列表类型:有序.可重复 [set类型] 1.添加元素 语法:sadd key member1 member2...... 返回值:返回 ...

  2. 统计学中的P值与显著性的意义

    统计学意义(p值) 结果的统计学意义是结果真实程度(能够代表总体)的一种估计方法.专业上,p值为结果可信程度的一个递减指标,p值越大,我们越不能认为样本中变量的关联是总体中各变量关联的可靠指标.p值是 ...

  3. linux漏洞分析入门笔记-bypass_PIE

    ubuntu 16.04 IDA 7.0 docker 0x00:漏洞分析 1.ASLR的是操作系统的功能选项,作用于executable(ELF)装入内存运行时,因而只能随机化stack.heap. ...

  4. python里面的encode和decode函数

    转自 http://www.cnblogs.com/evening/archive/2012/04/19/2457440.html 总结一句话 encode:    字符串打算输出(给别人用)比如pr ...

  5. 详解Struts1.x的运行机制及命名规则

    Struts1.x 调用一个action的大致流程: 1)首先前端发送 *.do的一个action请求(通过点击表单提交按钮,js 事件等): 2)web.xml 文件通过 *.do 找到 Actio ...

  6. gamemakerstudio:加载精灵

    如果精灵图片不是单一图片(拥有子图)可以称它为长条图,当gamemakerstudio加载这类精灵图片时,我们给图片名字命名为*_strip列数.*,这样当加载图片时gamemakerstudio会自 ...

  7. Sharepoint学习笔记--如何定位网站集所在的w3wp进程

     我们在调试WebPart或者EventHandler之类的自定义组件时会遇到如何定位部署的网站集所对应的w3wp.exe进程的问题,方法如下 : 方法1. 直接开始运行,输入cmd,再输入iisap ...

  8. jquery-tags-input 使用经历

    源代码里有这么一段,是在tagsInput这里,第一次初始化的时候是正常的,但当第二次初始化的时候就会出现问题,id的值会组合为  id+new Date().getTime() 暂时不清楚作用是什么 ...

  9. dedecms 权重排序问题

    isweight='y' orderway='asc'  orderby='weight'  依次进入根目录>dede 找到打开文件 album_edit.php   //找到更新数据库的SQL ...

  10. ACM-ICPC(10/21)

    写一发后缀数组套路题,看起来简单,写起来要人命哦~~~ 总共13题. 分两天debug吧,有点累了~~~ suffix(后缀数组的应用) sa[i] :排名第 i 的后缀在哪(i 从 1 开始) ra ...