Binlog中,除了具体的SQL,其实,还包含了很多有价值的信息,如,
拿到上面这些信息,我们可以做哪些事情呢?
开发了一个简单的Binlog分析工具-binlog_summary.py,可提取上面这些信息,并在此基础上,进行一些常见分析。
1. 下载地址
https://github.com/slowtech/dba-toolkit/blob/master/MySQL/binlog_summary.py
2. 参数解析
# python binlog_summary.py --help
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]
optional arguments:
-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
来源:https://www.cnblogs.com/ivictor/p/15114460.html
图文来源于网络,如有侵权请联系删除。