binlog关闭事务记录_【MySQL】binlog_format以及binlog事务记录分析
MySQL官方对于binlog_format参数的说明:
binlog_format可以动态修改,官网对于动态修改主库配置时提醒谨慎操作,会导致复制关系异常。
【主库flush logs,binlog_format=‘STATEMENT‘】
【从库flush logs,binlog_format=‘MIXED‘】
【主库】
# at107#140919 14:17:50 server id 16024 end_log_pos 178 Query thread_id=13 exec_time=0 error_code=0
SET TIMESTAMP=1411107470/*!*/;BEGIN
/*!*/;
# at178#140919 14:17:50 server id 16024 end_log_pos 281 Query thread_id=13 exec_time=0 error_code=0
use jiangxu/*!*/;SET TIMESTAMP=1411107470/*!*/;delete from t1 where c1 in (50,51,52)/*!*/;
# at281#140919 14:17:50 server id 16024 end_log_pos 353 Query thread_id=13 exec_time=0 error_code=0
SET TIMESTAMP=1411107470/*!*/;COMMIT/*!*/;
【从库】
# at107#140919 14:17:50 server id 16024 end_log_pos 178 Query thread_id=13 exec_time=253 error_code=0
SET TIMESTAMP=1411107470/*!*/;BEGIN
/*!*/;
# at178#140919 14:17:50 server id 16024 end_log_pos 281 Query thread_id=13 exec_time=253 error_code=0
use `jiangxu`/*!*/;SET TIMESTAMP=1411107470/*!*/;delete from t1 where c1 in (50,51,52)/*!*/;
# at281#140919 14:17:50 server id 16024 end_log_pos 353 Query thread_id=13 exec_time=253 error_code=0
SET TIMESTAMP=1411107470/*!*/;COMMIT/*!*/;
【主库flush logs,binlog_format=‘MIXED‘】
【从库flush logs,binlog_format=‘MIXED‘】
【主库】
# at107#140919 14:28:52 server id 16024 end_log_pos 178 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1411108132/*!*/;BEGIN
/*!*/;
# at178#140919 14:28:52 server id 16024 end_log_pos 281 Query thread_id=1 exec_time=0 error_code=0
use jiangxu/*!*/;SET TIMESTAMP=1411108132/*!*/;delete from t1 where c1 in (40,41,42)/*!*/;
# at281#140919 14:28:52 server id 16024 end_log_pos 308 Xid = 14
COMMIT/*!*/;
【从库】
# at353#140919 14:28:52 server id 16024 end_log_pos 412 Query thread_id=1 exec_time=253 error_code=0
SET TIMESTAMP=1411108132/*!*/;BEGIN
/*!*/;
# at412#140919 14:28:52 server id 16024 end_log_pos 515 Query thread_id=1 exec_time=253 error_code=0
SET TIMESTAMP=1411108132/*!*/;delete from t1 where c1 in (40,41,42)/*!*/;
# at515#140919 14:28:52 server id 16024 end_log_pos 542 Xid = 25540
COMMIT/*!*/;
【主库flush logs,binlog_format=‘ROW‘】
【从库flush logs,binlog_format=‘MIXED‘】
【主库】
# at107#140919 14:41:21 server id 16024 end_log_pos 178 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1411108881/*!*/;BEGIN
/*!*/;
# at178# at225#140919 14:41:21 server id 16024 end_log_pos 225 Table_map: `jiangxu`.`t1` mapped to number 33#140919 14:41:21 server id 16024 end_log_pos 275 Delete_rows: table id 33flags: STMT_END_F
###DELETE FROMjiangxu.t1
###WHERE###@1=30 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROMjiangxu.t1
###WHERE###@1=31 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROMjiangxu.t1
###WHERE###@1=32 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/# at275#140919 14:41:21 server id 16024 end_log_pos 302 Xid = 13
COMMIT/*!*/;
【从库】
# at542#140919 14:41:21 server id 16024 end_log_pos 601 Query thread_id=1 exec_time=253 error_code=0
SET TIMESTAMP=1411108881/*!*/;BEGIN
/*!*/;
# at601# at648#140919 14:41:21 server id 16024 end_log_pos 648 Table_map: `jiangxu`.`t1` mapped to number 1168#140919 14:41:21 server id 16024 end_log_pos 698 Delete_rows: table id 1168flags: STMT_END_F
###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=30 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=31 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=32 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/# at698#140919 14:41:21 server id 16024 end_log_pos 725 Xid = 25542
COMMIT/*!*/;
DELIMITER ;
#End of log file
ROLLBACK /*added by mysqlbinlog*/;/*!50003 SET [email protected]_COMPLETION_TYPE*/;
【主库flush logs,binlog_format=‘MIXED‘】
【从库flush logs,binlog_format=‘ROW‘】
注意动态修改从库binlog_format因为原session是MIXED,所以需要重建复制关系线程。
【主库】
# at554#140919 16:44:50 server id 16024 end_log_pos 625 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1411116290/*!*/;BEGIN
/*!*/;
# at625#140919 16:44:50 server id 16024 end_log_pos 728 Query thread_id=3 exec_time=0 error_code=0
SET TIMESTAMP=1411116290/*!*/;delete from t1 where c1 in (13,14,15)/*!*/;
# at728#140919 16:44:50 server id 16024 end_log_pos 755 Xid = 44
COMMIT/*!*/;
【从库】
# at296#140919 16:44:50 server id 16024 end_log_pos 355 Query thread_id=3 exec_time=253 error_code=0
SET TIMESTAMP=1411116290/*!*/;BEGIN
/*!*/;
# at355# at402#140919 16:44:50 server id 16024 end_log_pos 402 Table_map: `jiangxu`.`t1` mapped to number 1168#140919 16:44:50 server id 16024 end_log_pos 452 Delete_rows: table id 1168flags: STMT_END_F
###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=13 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=14 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/###DELETE FROM`jiangxu`.`t1`
###WHERE###@1=15 /*INT meta=0 nullable=0 is_null=0*/###@2=‘a‘ /*VARSTRING(15) meta=15 nullable=1 is_null=0*/# at452#140919 16:44:50 server id 16024 end_log_pos 479 Xid = 25570
COMMIT/*!*/;
在binlog_format=MIXED时候,哪种改变会被按照ROW进行记录到binlog,参考官方说明:
所以看得出在MIXED的状态下基本上对于主库的DDL操作无法按照行变化进行记录。
对于行变化的日志记录磁盘IO肯定要比语句复制消耗要大,可以根据架构酌情配置。
原文:http://www.cnblogs.com/jiangxu67/p/3981854.html
binlog关闭事务记录_【MySQL】binlog_format以及binlog事务记录分析相关推荐
- 同事操作两个数据源保持事务一致_终于有人把分布式事务说清楚了
前言 这篇文章将给大家介绍一下对分布式事务的一些见解,并讲解分布式事务处理框架 TX-LCN 的执行原理,错误之处望各位不吝指正. 1. 什么情况下需要使用分布式事务? 使用的场景很多,先举一个常见的 ...
- linux mysql 事务_linux下mysql Insert update delete 事务 用户管理
linux下mysql Insert update delete 事务 用户管理 1.INSERT插入语句格式: INSERT INTO tb_name (字段1, 字段2, ...) VALUES ...
- mysql中如何将一个表中的部分记录合并,MySQL数据库将多条记录的单个字段合并成一条记录_MySQL...
bitsCN.com MySQL数据库将多条记录的单个字段合并成一条记录 MySQL数据库将多条记录的单个字段合并成一条记录的操作是本文 我们主要要介绍的内容,接下来就让我们一起来了解一下这部分内容吧 ...
- 银行转账java代码事务实现_转账操作代码实现----事务
在进行转账操作时,我们要保证数据的统一性.(例如,当一个账户转出金额过程中,如果出现系统错误或者说是停电断网等特殊情况,将会发生转出账户减少,转入账户金额未添加的情况.)因此,我们需要通过事务控制: ...
- tp5模型能实现事务吗_实现工作单元-通过事务模型处理域对象
tp5模型能实现事务吗 Even in the most basic scenario you can picture, where the logic of an application's cor ...
- iphone重启记录_如何阻止您的iPhone记录您的常用位置
iphone重启记录 It can be a little unnerving when your iPhone seems to know your routine, like it has ESP ...
- 只读事务上下文_我可以/应该在事务上下文中使用并行流吗?
只读事务上下文 介绍 长话短说,您不应在并行流中使用事务. 这是因为并行流中的每个线程都有其自己的名称,因此它确实参与了事务. Streams API旨在在某些准则下正常工作. 实际上,为了受益于并行 ...
- hql取满足条件最新一条记录_数据仓库怎么做拉链表记录数据变化情况,看看这篇文章 就明白了...
小文老师给你讲解数据仓库的ETL拉链算法,通过这篇文档,让你快速了解数据拉链. 一 首先我们先来看下,什么是拉链?在数据仓库中,拉链就是记录数据在某一时间区间内的状态以及数据在某一时间点上的数据变化的 ...
- sqlserver 怎么查看操作记录_抖音怎么查看访问记录,访客记录在哪里看的?
我们都知道QQ是能查看自己的访客记录的,那么抖音呢?在抖音看了别人的视频会留下记录吗?抖音能看到近期访客吗?我们一起来了解一下吧! 抖音能看到近期访客吗 目前来说,抖音里并没提供查看访客记录的功能,用 ...
- 禅道报表中关闭bug统计图_想要简单制作数据可视化分析报表?这个工具绝对好用...
说到分析报表,行外小白都会觉得很简单,不就是整理数据到表格吗?但对于从事相关职业的同行来说,肯定多多少少会被报表困扰过.特别是对于一些高级的Excel报表,可是它需要复杂的函数,使用编程代码处理,上手 ...
最新文章
- 整理的16个有用的jQuery Form(表单)验证教程
- linux nohup 英文全称 no hang up(
- 策略模式(Header-First笔记)
- js中常用的算法排序
- Python爬虫应用实战-网站数据爬取及数据分析
- 论文浅尝 | 基于图卷积网络的跨语言图谱实体对齐
- [转载] Python numpy insert()、 delete()、append()函数的用法
- 中图分类法----S 农业科学
- 提高电脑性能增加fps的方法
- 基于python的ansys_基于Python与ANSYS的达芬方程计算程序
- 电子产品PCB电路板散热的方法
- 银行普惠金融可持续发展能力建设——风控科技应用
- 苹果手机防盗软件_魅族手机防盗拍照功能可以成功定位,比其他的防盗软件好用...
- 微型计算机系统中,prom是,微型计算机系统中,PROM是A.可读写存储器B.动态随机存取存储器C.只读存储器D.可编程只读存储器...
- 内存卡数据恢复软件哪个好?看看谁才是恢复软件中的MVP
- VIVADO如何打开.ila波形文件
- MATLAB数学建模之排列图和柱状图
- 安卓毕业设计app项目成品在线投票app毕业设计作品
- 50个最精彩的 Photoshop 实例教程【绘图篇】
- 固态硬盘只安装linux系统盘,旧笔记本折腾记:升级SSD 安装深度Linux系统