mysql雙1設定

來源:互聯網
上載者:User

標籤:async   進位   log   會同   div   logs   flush   日誌   mysql   

innodb_flush_log_at_trx_commit和sync_binlog 兩個參數是控制MySQL磁碟寫入策略以及資料安全性的關鍵參數。

如果innodb_flush_log_at_trx_commit設定為0,log buffer將每秒一次地寫入log file中,並且log file的flush(刷到磁碟)操作同時進行.
該模式下,在事務提交的時候,不會主動觸發寫入磁碟的操作。
如果innodb_flush_log_at_trx_commit設定為1,每次事務提交時MySQL都會把log buffer的資料寫入log file,並且flush(刷到磁碟)中去.
如果innodb_flush_log_at_trx_commit設定為2,每次事務提交時MySQL都會把log buffer的資料寫入log file.但是flush(刷到磁碟)操作並不會同時進行。
該模式下,MySQL會每秒執行一次 flush(刷到磁碟)操作。


sync_binlog
sync_binlog 的預設值是0,像作業系統刷其他檔案的機制一樣,MySQL不會同步到磁碟中去而是依賴作業系統來重新整理binary log。
當sync_binlog =N (N>0) ,MySQL 在每寫N次二進位日誌binary log時,會使用fdatasync()函數將它的寫二進位日誌binary log同步到磁碟中去。

 

mysql雙1設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.