首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    工具分享丨分析GreatSQL Binglog神器

    事务控制事件涵盖了事务的起始时间、起始位置、结束时间和结束位置。通过这些详细信息,我们能够计算事务的大小,进而评估其是否属于大型事务,以及是否可能引起主从同步的延迟问题,及时发现大事务,可避免复制故障。 简介 本文分享的神器的名字就叫做binlog_summary,出自陈臣老师的手笔,也是开源的Python脚本文件,开源地址:https://github.com/slowtech/dba-toolkit/blob/master/mysql/binlog_summary.py 下载 运行此工具需要有Python环境,若没有python环境请自行下载 下载binlog_summary.py脚本,并授权 $ wget https://raw.githubusercontent.com/slowtech/dba-toolkit/master/mysql/binlog_summary.py $ chmod 755 binlog_summary.py 先用./binlog_summary.py -h查看下帮助 $ ./binlog_summary.py -h usage: binlog_summary.py [-h] [-f BINLOG_TEXT_FILE] [--new] [-c {tps,opr,transaction}] [--start START_DATETIME] [--stop STOP_DATETIME] [--sort SORT_CONDITION] [-e] [--limit LIMIT] options: -h, --help show this help message and exit -f BINLOG_TEXT_FILE, --file BINLOG_TEXT_FILE Binlog text file, not the Raw binary file --new Make a fresh start -c {tps,opr,transaction}, --command {tps,opr,transaction} Command type: [tps, opr, transaction],tps: transaction per second, opr: dml per table, transaction: show transaction info --start START_DATETIME Start datetime, for example: 2004-12-25 11:25:56 --stop STOP_DATETIME Stop datetime, for example: 2004-12-25 11:25:56 --sort SORT_CONDITION Sort condition: time or size, you can use it when command type is transaction -e, --extend Show transaction info in detail,you can use it when command type is transaction --limit LIMIT Limit the number of rows to display 其中参数介绍:

    01

    怎么避免从删库到跑路 -- 详解 mysql binlog 的配置与使用

    使用数据库的时候,我们每个操作都十分小心,尤其是不能直接在数据库上执行 update、delete 等操作,否则万一忘记加全 where 条件,可能就会造成无法挽回的结果。 有一句十分流行的调侃 — “从删库到跑路”就很形象的说明了误操作后的结果,那么如果你真的不小心执行了删库操作,真的就无法挽回了吗? 当然不会了,通常对于线上数据库,我们都会定时冷备,dump 导出数据库的全量备份,并且保留一段时间内的所有修改日志,进而实现在必要时回滚到这段时间内的任何一秒。 这里提到的“日志”指的就是 binlog,那么究竟什么是 binlog 呢?本文我们就来详细介绍一下。

    02
    领券