【问题标题】:How to disable binlog in pt-archiver如何在 pt-archiver 中禁用 binlog
【发布时间】:2018-03-09 18:56:36
【问题描述】:

我正在使用 percona 的 pt-archive 实用程序归档大表。但它填满了我的二进制日志。

在从这个实用程序存档期间是否有任何选项可以禁用二进制日志记录。

我已经阅读了它的文档,我们可以在 --analyze 选项中做一些事情,但它没有明确如何定义它。因为这个选项还优化/分析了我不想要的表。

您能提供任何工作示例吗?

【问题讨论】:

    标签: mysql database archive percona mysql-5.7


    【解决方案1】:

    简而言之,您需要添加选项 b=true 和 --local

    请注意,b=true 是一个 DSN 选项,需要在 --source 或 --dest 之后添加,具体取决于您的需要。我将在此答案的底部展示一个示例。

    您可以轻松地尝试这个虚拟测试:

     CREATE TABLE `dummyids` (
      `ids` int(11) NOT NULL AUTO_INCREMENT,
      PRIMARY KEY (`ids`)
    ) ENGINE=InnoDB ;
    
    
    insert into dummyids
        select @i := @i + 1 as id
         from (select true union all select true) t0
        join (select true union all select true) t1
        join (select true union all select true) t2
        join (select true union all select true) t3
        join (select true union all select true) t4
        join (select true union all select true) t5
        join (select true union all select true) t6
        join (select true union all select true) t7
        join (select true union all select true) t8
        join (select true union all select true) t9
        join (select true union all select true) t10
        join (select true union all select true) t11
        join (select true union all select true) t12
        join (select true union all select true) t13
        join (select true union all select true) t14
        join (select true union all select true) t15
        join (select true union all select true) t16
        join (select true union all select true) t17
        join (select true union all select true) t18
        join (select true union all select true) t19
    ;
    

    现在您可以检查 binlog 的大小和最后位置(它将是最新的 binlog,请更改您的路径和 binlog 名称)

    # ls -lh /path/to/mysql/data/
    
    # sudo mysqlbinlog mysql-bin.000012 | tail -n 100
    

    记录运行 pt archive 后 binlog 的位置和大小进行比较

    pt-archiver --source h=localhost,D=bar,t=dummyids,b=true --local --where "1 = 1" --limit=10000 --progress=50000 --txn-size=50000 --statistics --purge --bulk-delete
    

    现在再次运行命令检查 binlog 的大小和最新位置,您应该注意到它们没有改变。

    希望这可以帮助更多有相同问题的人。

    选项在percona工具手册pt-archiver options中有解释

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-22
      相关资源
      最近更新 更多