首頁 資料庫 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或电源故障导致丢失最后一秒的事务)

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_binlog

sync_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脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1664
14
CakePHP 教程
1423
52
Laravel 教程
1317
25
PHP教程
1268
29
C# 教程
1247
24
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的有效

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

SpringDataJPA基於JPA架構,透過映射、ORM和事務管理與資料庫互動。其儲存庫提供CRUD操作,派生查詢簡化了資料庫存取。此外,它使用延遲加載,僅在必要時檢索數據,從而提高了效能。

C++ 函式參數型別安全檢查 C++ 函式參數型別安全檢查 Apr 19, 2024 pm 12:00 PM

C++參數類型安全檢查透過編譯時檢查、執行時間檢查和靜態斷言確保函數只接受預期類型的值,防止意外行為和程式崩潰:編譯時類型檢查:編譯器檢查類型相容性。運行時類型檢查:使用dynamic_cast檢查類型相容性,不符則拋出異常。靜態斷言:在編譯時對型別條件進行斷言。

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語言的基礎知識有較好的理解。具有後端開發經驗會有所幫助。複雜度不同的框架導致學習曲線差異。

手撕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

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參數評測大全性能跑分

開源模型首勝GPT-4!競技場最新戰報引熱議,Karpathy:這是我唯二信任的榜單 開源模型首勝GPT-4!競技場最新戰報引熱議,Karpathy:這是我唯二信任的榜單 Apr 10, 2024 pm 03:16 PM

能打得過GPT-4的開源模型出現了!大模型競技場最新戰報:1040億參數開源模型CommandR+攀升至第6位,與GPT-4-0314打成平手,超過了GPT-4-0613。圖片這也是第一個在大模型競技場上擊敗GPT-4的開放權重模型。大模型競技場,可是大神Karpathy口中唯二信任的測試基準之一。圖片CommandR+來自AI獨角獸Cohere。這家大模型新創公司的共同創辦人兼CEO,正是Transformer最年輕作者AidanGomez(簡稱割麥子)。圖片這份戰報一出,又掀起了一波大模型社

See all articles