mysql binlog events_MySQL中binlog参数:binlog_rows_query_log_events

在使用RBR也就是行格式的时候,去解析binlog,需要逆向才能分析出对应的原始SQL是什么,而且,里面对应的是每一条具体行变更的内容。当然,你可以开启general log,但如果我们需要的只是记录对应的行变更,而不需要记录这些select普通的查询,因为general log 会将线上所有的操作都记录下来,这种功能适合于我们审核统计,但是不适合我们对事务进行判断,故此,我们使用binlog_rows_query_log_events进行查看。在官网中的解析如下

binlog_rows_query_log_events

9448bda063d1b36b11f030628cb4f2c5.png

The binlog_rows_query_log_events system variable affects row-based logging only. When enabled, it causes a MySQL 5.6.2 or later server

to write informational log events such as row query log events into its binary log. This information can be used for debugging and related purposes;

such as obtaining the original query issued on the master when it cannot be reconstructed from the row updates.

These events are normally ignored by MySQL programs reading the binary log and so cause no issues when replicating or restoring from backup.

To view them, increase the verbosity level by using mysqlbinlog's --verbose option twice, either as "-vv" or "--verbose --verbose".

可以看到,它是一个动态的,全局,会话型的变量,即可以通过SQL模式进行关闭开启。

在未开启状态中的使用

[root@localhost][boss]> flush logs;

Query OK, 0 rows affected (0.90 sec)

[root@localhost][boss]> flush logs;

Query OK, 0 rows affected (0.18 sec)

[root@gzx-master-01 logs]# ll

total 8977656

-rw-r----- 1 mysql mysql 79405 Apr 24 08:42 error.log

-rw-r----- 1 mysql mysql 217 Mar 10 10:42 mysql_bin.000013

-rw-r----- 1 my

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值