首页 数据库 mysql教程 MySQLHA架构下innodb_flush_log_at_trx_commit及sync_binlog参数_MySQL

MySQLHA架构下innodb_flush_log_at_trx_commit及sync_binlog参数_MySQL

Jun 01, 2016 pm 01:01 PM
参数 架构

HeartBeat DRBD以及MySQL replication是很多企业比较普遍使用的方式。对于数据的完整性和一致性的问题,这两种架构需要考虑2个重要的参数innodb_flush_log_at_trx_commit以及sync_binlog参数。本文主要参考了MySQL 5.6 Reference Manual列出对这2个参数的具体描述。

1、Heartbeat DRBD or replication

?Cost: Additional passive master server (not handing any application traffic) is needed

?Performance: To make HA really work on DRBD replication environments, innodb-flush-log-at-trx-commit and sync-binlog must be 1. But these kill write performance

?Otherwise necessary binlog events might be lost on the master. Then slaves can’t continue replication, and data consistency issues happen

2、参数innodb_flush_log_at_trx_commit

innodb_flush_log_at_trx_commit参数为全局动态参数,其取值范围为0,1,2,缺省值为0

value

action

0

With a value of 0, any mysqld process crash can erase the last second of transactions. The log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but no writes are done at a transaction commit.(mysqld 进程crash会导致丢失最后一秒的事务)

1

The default value of 1 is required for full ACID compliance. With this value, the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file.

2

With a value of 2, only an operating system crash or a power outage can erase the last second of transactions. The log buffer is written out to the file at each commit, but the flush to disk operation is not performed on it. Before MySQL 5.6.6, the flushing on the log file takes place once per second. Note that the once-per-second flushing is not 100% guaranteed to happen every second, due to process scheduling issues. As of MySQL 5.6.6, flushing frequency is controlled by innodb_flush_log_at_timeout instead.( 操作系统crash或电源故障导致丢失最后一秒的事务)

value

action

0

With a value of 0, any mysqld process crash can erase the last second of transactions. The log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but no writes are done at a transaction commit.(mysqld 进程crash会导致丢失最后一秒的事务)

1

The default value of 1 is required for full ACID compliance. With this value, the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file.

2

With a value of 2, only an operating system crash or a power outage can erase the last second of transactions. The log buffer is written out to the file at each commit, but the flush to disk operation is not performed on it. Before MySQL 5.6.6, the flushing on the log file takes place once per second. Note that the once-per-second flushing is not 100% guaranteed to happen every second, due to process scheduling issues. As of MySQL 5.6.6, flushing frequency is controlled by innodb_flush_log_at_timeout instead.( 操作系统crash或电源故障导致丢失最后一秒的事务)

InnoDB's crash recovery works regardless of the value. Transactions are either applied entirely or erased entirely.(Innodb存储引擎存与该参数无关,可以通过crash recovery来解决,要么提交,要么回滚)For the greatest possible durability and consistency in a replication setup using InnoDB with transactions, use innodb_flush_log_at_trx_commit =1 and sync_binlog=1 in your master server my.cnf file. 3、参数sync_binlogsync_binlog为全局动态参数,取值范围为0 .. 18446744073709547520,缺省值为0。If the value of this variable is greater than 0, the MySQL server synchronizes its binary log to disk (using fdatasync()) after every sync_binlog writes to the binary log. There is one write to the binary log per statement if autocommit is enabled, and one write per transaction otherwise.The default value of sync_binlog is 0, which does no synchronizing to disk. A value of 1 is the safest choice, because in the event of a crash you lose at most one statement or transaction from the binary log. However, it is also the slowest choice (unless the disk has a battery-backed cache, which makes synchronization very fast).
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

AI Hentai Generator

AI Hentai Generator

免费生成ai无尽的。

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
1 个月前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
4 周前 By 尊渡假赌尊渡假赌尊渡假赌

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

i9-12900H参数评测大全 i9-12900H参数评测大全 Feb 23, 2024 am 09:25 AM

i9-12900H是14核的处理器,使用的架构和工艺都是全新的,线程也很高,整体的工作都是很优秀的,一些参数都有提升特别的全面,是可以给用户们带来极佳体验的。i9-12900H参数评测大全评测:1、i9-12900H是14核的处理器,采用了q1架构以及24576kb的制程工艺,提升到了20个线程。2、最大的CPU频率是1.80!5.00ghz,整体主要取决于工作的负载。3、相比较价位来说还是特别合适的,性价比很不错,对于一些需要正常使用的伙伴来说非常的合适。i9-12900H参数评测大全性能跑分

Spring Data JPA 的架构和工作原理是什么? Spring Data JPA 的架构和工作原理是什么? Apr 17, 2024 pm 02:48 PM

SpringDataJPA基于JPA架构,通过映射、ORM和事务管理与数据库交互。其存储库提供CRUD操作,派生查询简化了数据库访问。此外,它使用延迟加载,仅在必要时检索数据,从而提高了性能。

1.3ms耗时!清华最新开源移动端神经网络架构 RepViT 1.3ms耗时!清华最新开源移动端神经网络架构 RepViT Mar 11, 2024 pm 12:07 PM

论文地址:https://arxiv.org/abs/2307.09283代码地址:https://github.com/THU-MIG/RepViTRepViT在移动端ViT架构中表现出色,展现出显着的优势。接下来,我们将探讨本研究的贡献所在。文中提到,轻量级ViTs通常比轻量级CNNs在视觉任务上表现得更好,这主要归功于它们的多头自注意力模块(MSHA)可以让模型学习全局表示。然而,轻量级ViTs和轻量级CNNs之间的架构差异尚未得到充分研究。在这项研究中,作者们通过整合轻量级ViTs的有效

C++程序以给定值为参数,找到双曲正弦反函数的值 C++程序以给定值为参数,找到双曲正弦反函数的值 Sep 17, 2023 am 10:49 AM

双曲函数是使用双曲线而不是圆定义的,与普通三角函数相当。它从提供的弧度角返回双曲正弦函数中的比率参数。但要做相反的事,或者换句话说。如果我们想根据双曲正弦值计算角度,我们需要像双曲反正弦运算一样的反双曲三角运算。本课程将演示如何使用C++中的双曲反正弦(asinh)函数,使用双曲正弦值(以弧度为单位)计算角度。双曲反正弦运算遵循以下公式-$$\mathrm{sinh^{-1}x\:=\:In(x\:+\:\sqrt{x^2\:+\:1})},其中\:In\:是\:自然对数\:(log_e\:k)

golang框架架构的学习曲线有多陡峭? golang框架架构的学习曲线有多陡峭? Jun 05, 2024 pm 06:59 PM

Go框架架构的学习曲线取决于对Go语言和后端开发的熟悉程度以及所选框架的复杂性:对Go语言的基础知识有较好的理解。具有后端开发经验会有所帮助。复杂性不同的框架导致学习曲线差异。

C++ 函数参数类型安全检查 C++ 函数参数类型安全检查 Apr 19, 2024 pm 12:00 PM

C++参数类型安全检查通过编译时检查、运行时检查和静态断言确保函数只接受预期类型的值,防止意外行为和程序崩溃:编译时类型检查:编译器检查类型相容性。运行时类型检查:使用dynamic_cast检查类型相容性,不匹配则抛出异常。静态断言:在编译时对类型条件进行断言。

手撕Llama3第1层: 从零开始实现llama3 手撕Llama3第1层: 从零开始实现llama3 Jun 01, 2024 pm 05:45 PM

一、Llama3的架构在本系列文章中,我们从头开始实现llama3。Llama3的整体架构:图片Llama3的模型参数:让我们来看看这些参数在LlaMa3模型中的实际数值。图片[1]上下文窗口(context-window)在实例化LlaMa类时,变量max_seq_len定义了context-window。类中还有其他参数,但这个参数与transformer模型的关系最为直接。这里的max_seq_len是8K。图片[2]词汇量(Vocabulary-size)和注意力层(AttentionL

综述!全面概括基础模型对于推动自动驾驶的重要作用 综述!全面概括基础模型对于推动自动驾驶的重要作用 Jun 11, 2024 pm 05:29 PM

写在前面&笔者的个人理解最近来,随着深度学习技术的发展和突破,大规模的基础模型(FoundationModels)在自然语言处理和计算机视觉领域取得了显着性的成果。基础模型在自动驾驶当中的应用也有很大的发展前景,可以提高对于场景的理解和推理。通过对丰富的语言和视觉数据进行预训练,基础模型可以理解和解释自动驾驶场景中的各类元素并进行推理,为驾驶决策和规划提供语言和动作命令。基础模型可以根据对驾驶场景的理解来实现数据增强,用于提供在常规驾驶和数据收集期间不太可能遇到的长尾分布中那些罕见的可行

See all articles