zoukankan      html  css  js  c++  java
  • percona-toolkit常用工具

    安装:
    yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
    percona-release setup ps80
    yum install percona-toolkit

    1.pt-archiver
    某些存在时效性的数据,在达到特定条件后,需要进行归档和回收处理。
    # 归档到其他数据库,并删除原表中对应的行
    pt-archiver --source h=host1,P=port,u=repl,p=repl,D=sbtest,t=sbtest1,A=utf8 --where "id<=1000" --dest h=host2,P=port,u=dba,p=dba,D=sbtest,t=sbtest1,A=utf8
    # 归档到其他数据库, 不删除原表中对应的行
    pt-archiver --source h=host1,P=port,u=repl,p=repl,D=sbtest,t=sbtest1,A=utf8 --no-delete --where "id<=1000" --dest h=host2,P=port,u=dba,p=dba,D=sbtest,t=sbtest1,A=utf8
    # 归档到文件,并删除原表中对应的行
    pt-archiver --source h=host1,P=port,u=repl,p=repl,D=sbtest,t=sbtest1,A=utf8 --file=/tmp/archive.save --where "id<=1000"
    # 归档到文件, 不删除原表中对应的行
    pt-archiver --source h=host1,P=port,u=repl,p=repl,D=sbtest,t=sbtest1,A=utf8 --no-delete --file=/tmp/archive.save --where "id<=1000"
    # 导入归档文件
    mysql> load data infile "/tmp/archive.save" into table sbtest.sbtest1;
    Query OK, 1000 rows affected (0.49 sec)
    Records: 1000 Deleted: 0 Skipped: 0 Warnings: 0

    2.pt-config-diff
    对比配置文件和运行时参数
    pt-config-diff /etc/my.cnf /etc/my1.cnf
    pt-config-diff h=192.168.2.110,P=3306,u=root,p=lisg1 h=192.168.2.110,P=3307,u=root,p=lisg2

    3.pt-heartbeat
    在主库上开启守护进程创建heatbeat表
    pt-heartbeat h=192.168.2.110,u=root --ask-pass --interval=2 -D test --create-table --update --daemonize
    在主库上进行复制延迟监控
    pt-heartbeat h=192.168.2.112,u=root --ask-pass -D test --monitor --interval=2

    4.pt-deadlock-logger
    死锁检测并把死锁信息写入到日志或者表中
    pt-deadlock-logger h=192.168.2.110,u=root,p=lisg1 --create-dest-table --dest D=test,t=deadlock --daemonize
    pt-deadlock-logger h=192.168.2.110,u=root,p=lisg1 --log /tmp/deadlock.log --daemonize

    5.pt-duplicate-key-checker
    检查冗余索引并给出优化
    pt-duplicate-key-checker h=192.168.2.110,u=root,p=lisg1,D=test

    6.pt-online-schema-change
    在线更改表结构
    pt-online-schema-change --alter='add age tinyint not null default 0' --execute h=192.168.2.110,u=root,p=lisg1,D=test,t=t1
    pt-online-schema-change --alter='add key key_name(column)' --execute h=192.168.2.110,u=root,p=lisg1,D=test,t=t1

    7.pt-slave-delay
    指定从库延迟
    pt-slave-delay --delay=3m --run-time=5m --daemonize --log /tmp/test.log h=192.168.2.112,u=root,p=lisg1 h=192.168.2.110,u=root,p=lisg1
    insert into t3(name,age,sex,id_card,phone_number,address) values('刘备',60,'M','420921198012345678','18678782990','大悟县宣化镇');
    insert into t3(name,age,sex,id_card,phone_number,address) values('曹操',70,'M','420922199001234010','18190002313','大悟县三里镇');

    8.pt-table-checksum
    检查主从一致性
    pt-table-checksum --databases=test --tables=t3 --nocheck-binlog-format --nocheck-replication-filters h=192.168.2.110,u=root,p=lisg1
    修复主从一致性
    pt-table-sync --databases=test --tables=t3 --replicate=percona.checksums --execute h=192.168.2.110,u=root,p=lisg1

    9.pt-variable-advisor
    检查系统变量并给出优化建议
    pt-variable-advisor --verbose h=192.168.2.110,u=root,p=lisg1

  • 相关阅读:
    [转]PublishingFeatureHandler(发布功能参数)
    抽象类与接口使用的MSDN建议
    [转]SharePoint内容定制之XSLT高级用法——使用Muenchian方法分组XML数据
    MOSS中的DelegateControl机制
    [转]SharePoint内容定制之XSLT高级用法——带返回值的函数调用
    问题:加了访问权限也无法访问网站。
    [转]Writing Custom Entries to the Audit Log in Windows SharePoint Services 3.0(如何记录自定义审核日志)
    .NET使用C#连接TIBCO的JMS消息服务
    [转]SharePoint 2007 and 2010 Farm ports – configuring firewall(如何配置服务器场中的防火墙)
    [转] SharePoint Features elements, scope and other info
  • 原文地址:https://www.cnblogs.com/lishug/p/13215238.html
Copyright © 2011-2022 走看看