一、双1参数
1、innodb_flush_log_at_trx_commit
复制代码
1
2
3
4
5
6
7
8
9innodb_flush_log_at_trx_commit这个参数控制MySQL在事务提交时将内存中的Redo log file从Redo log buffer刷新到磁盘(Redo log file)的方式。 value: 0 1 2 1)0 每秒钟将内存中Redo log File从Redo Log Buffer刷新到OS Buffer并调用fsync()将OS Buffer刷新到磁盘(数据库宕机时,可能会有数据丢失) 2)1 默认为1,表示每次事务提交时会将Redo Log File从Redo Log Buffer中刷新到OS Buffer,并且会调用fsync()将OS Buffer刷新到磁盘(数据库宕机时,不会有数据丢失) 3)2 每次事务提交时会将内存中Redo Log File从Redo Log Buffer中刷新到OS Buffer,每秒钟调用fsync()将OS Buffer刷新到磁盘(数据库宕机时,可能会有数据丢失)
2、sync_binlog
复制代码
1
2
3
4
5
6
7
8
9
10sync_binlog参数控制将内存中binlog从binlog buffer中刷新到磁盘的方式 value : 0 1 N 1)0 由OS决定什么时候调用fsync()来将内存中binlog file从binlog buffer刷新到磁盘(binlog file). 2)1 每次事务提交时,将内存中binlog file从binlog buffer中刷新到磁盘(binlog file). 3)N 每N次事务提交时,将内存中的binlog file从binlog buffer中刷新到磁盘(binlog file). 注:binlog buffer满的时候会自动调用fsync()同步binlog buffer到磁盘(binlog file).
二、两阶段提交
MySQL采用两阶段提交的方式来保证有数据库变更的时候写入Redo Log File和Binlog File数据的一致性.
复制代码
1
2
3
4
51、Redo Write 2、Redo prepare(fsync()) 3、Binlog Write 4、Redo Commit
最后
以上就是陶醉菠萝最近收集整理的关于MySQL双1参数innodb_flush_log_at_trx_commit、sync_binlog和两阶段提交的全部内容,更多相关MySQL双1参数innodb_flush_log_at_trx_commit、sync_binlog和两阶段提交内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复