sync_binlog

5.6默認值0,到了5.7默認是1

sync_binlog

成都創(chuàng)新互聯(lián)不只是一家網(wǎng)站建設的網(wǎng)絡公司;我們對營銷、技術、服務都有自己獨特見解,公司采取“創(chuàng)意+綜合+營銷”一體化的方式為您提供更專業(yè)的服務!我們經(jīng)歷的每一步也許不一定是最完美的,但每一步都有值得深思的意義。我們珍視每一份信任,關注我們的網(wǎng)站設計、網(wǎng)站制作質量和服務品質,在得到用戶滿意的同時,也能得到同行業(yè)的專業(yè)認可,能夠為行業(yè)創(chuàng)新發(fā)展助力。未來將繼續(xù)專注于技術創(chuàng)新,服務升級,滿足企業(yè)一站式成都全網(wǎng)營銷推廣需求,讓再小的品牌網(wǎng)站設計也能產生價值!

Command-Line Format --sync-binlog=#
System Variable Name sync_binlog
Variable Scope Global
Dynamic Variable Yes
Permitted Values (32-bit platforms) Type integer
Default 0
Min Value 0
Max Value 4294967295
Permitted Values (64-bit platforms) Type integer
Default 0
Min Value 0
Max Value 4294967295

If the value of this variable is greater than 0, the MySQL server synchronizes its binary log to disk (using fdatasync()) after sync_binlog commit groups are written to the binary log. The default value of sync_binlog is 0, which does no synchronizing to disk—in this case, the server relies on the operating system to flush the binary log's contents from time to time as for any other file. A value of 1 is the safest choice because in the event of a crash you lose at most one commit group from the binary log. However, it is also the slowest choice (unless the disk has a battery-backed cache, which makes synchronization very fast).

百度翻譯:如果這個變量的值大于0,MySQL服務器同步二進制日志到磁盤(使用fdatasync())后sync_binlog犯組寫入二進制日志。sync_binlog的默認值是0,并沒有同步在這種情況下,磁盤,服務器依賴于操作系統(tǒng)的二進制日志的內容刷新時間為任何其他文件。一個1的值是最安全的選擇,因為在一個崩潰的事件,你失去了最一個提交組從二進制日志。然而,它也是最慢的選擇(除非磁盤具有電池備份的高速緩存,這使得同步非??欤?br />


sync_binlog=1 or N
     This makes MySQL synchronize the binary log’s contents to disk each time it commits a transaction 
     默認情況下,并不是每次寫入時都將binlog與硬盤同步。因此如果操作系統(tǒng)或機器(不僅僅是MySQL服務器)崩潰,有可能binlog中最后的語句丟 失了。要想防止這種情況,你可以使用sync_binlog全局變量(1是最安全的值,但也是最慢的),使binlog在每N次binlog寫入后與硬盤 同步。即使sync_binlog設置為1,出現(xiàn)崩潰時,也有可能表內容和binlog內容之間存在不一致性。如果使用InnoDB表,MySQL服務器 處理COMMIT語句,它將整個事務寫入binlog并將事務提交到InnoDB中。如果在兩次操作之間出現(xiàn)崩潰,重啟時,事務被InnoDB回滾,但仍 然存在binlog中。可以用--innodb-safe-binlog選項來增加InnoDB表內容和binlog之間的一致性。(注釋:在MySQL 5.1中不需要--innodb-safe-binlog;由于引入了XA事務支持,該選項作廢了),該選項可以提供更大程度的安全,使每個事務的 binlog(sync_binlog =1)和(默認情況為真)InnoDB日志與硬盤同步,該選項的效果是崩潰后重啟時,在滾回事務后,MySQL服務器從binlog剪切回滾的 InnoDB事務。這樣可以確保binlog反饋InnoDB表的確切數(shù)據(jù)等,并使從服務器保持與主服務器保持同步(不接收 回滾的語句)。

網(wǎng)頁名稱:sync_binlog
網(wǎng)頁URL:http://bm7419.com/article8/igepip.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、商城網(wǎng)站Google、網(wǎng)站建設品牌網(wǎng)站制作、響應式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)