码迷,mamicode.com
首页 > 其他好文 > 详细

通过binlog统计DML操作的次数

时间:2020-04-30 15:23:31      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:汇总   统计   lock   back   out   center   次数   x86_64   info   

解析分析线上30分中26G的binlog,排查阿里云RDS主库插入ROWS和监控数据不匹配问题。
解析binlog汇总到一起:

for i in ls /mnt/bi/;do
/opt/software/mysql-8.0.19-linux-glibc2.12-x86_64/bin/mysqlbinlog -v --base64-output=decode-rows $i >> all_decoded.sql
done

对解析的binlog进行INSERT筛选按执行次数排序统计:

[root@backup bi_decode]# grep -i ‘INSERT INTO datacenter‘ all_decoded.sql|sort -n|uniq -c|sort -n -k 1 -r
4924224 ### INSERT INTO datacenter.fr_mid_go_up_log
3053223 ### INSERT INTO datacenter.fr_mid_shop_station_go_up
2376044 ### INSERT INTO datacenter.mid_small_big_station_heart
878781 ### INSERT INTO datacenter.fr_station_battery_monitor_his_20200429
611570 ### INSERT INTO datacenter.fr_mid_station_borrow_count
603260 ### INSERT INTO datacenter.fr_mid_station_profit
478563 ### INSERT INTO datacenter.fr_station_lost_detail
184708 ### INSERT INTO datacenter.fr_station_seller_monitor_v2
106951 ### INSERT INTO datacenter.empty_battery_station_detail
61646 ### INSERT INTO datacenter.fr_station_seller_monitor_his
58213 ### INSERT INTO datacenter.fr_station_region_monitor_v2
30290 ### INSERT INTO datacenter.fr_mid_orgr2user
22269 ### INSERT INTO datacenter.fr_mid_seller_trade_info
19425 ### INSERT INTO datacenter.fr_station_region_monitor_his
17814 ### INSERT INTO datacenter.fr_mid_ycb_manager_organization_rela_all_03

通过binlog统计DML操作的次数

标签:汇总   统计   lock   back   out   center   次数   x86_64   info   

原文地址:https://blog.51cto.com/kenneyzhou/2491793

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!