您好,登錄后才能下訂單哦!
這篇文章主要介紹“MySQL半同步SLAVE是什么”,在日常操作中,相信很多人在MySQL半同步SLAVE是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”MySQL半同步SLAVE是什么”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
Mysql半同步SLAVE,類似于ORACLE安全模式的DATAGUARD(但不完全是);
為什么是半同步呢,因為MYSQL只保證“至少一個”SLAVE接收到日志后返回;
雖然可能不會有太多的人去用這個東西(因為對網絡的要求和機器的穩定性很高);但MYSQL還是補全了這一塊的功能缺失
A commit performed on the master side blocks before returning to the session
that performed the transaction until at least one slave acknowledges that it has received
and logged the events for the transaction.
Semisynchronous replication is implemented through an optional plugin component.
See Section 17.3.8, “Semisynchronous Replication”.
http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
The slave acknowledges receipt of a transaction's events only after the events have been written to its relay log and flushed to disk.
只有SLAVE接收到日志寫入到RELAY-LOG,并刷新到磁盤才算同步成功;
If a timeout occurs without any slave having acknowledged the transaction, the master reverts to asynchronous replication
如果日志傳輸過程中發生超時現象;那么SLAVE將恢復到異步方式;
Semisynchronous replication must be enabled on both the master and slave sides. If semisynchronous replication is disabled on the master, or enabled on the master but on no slaves, the master uses asynchronous replication
半同步復制方式必須在MASTER和SLAVE同時打開;否則還是采用異步方式;
While the master is blocking (waiting for acknowledgment from a slave after having performed a commit), it does not return to the session that performed the transaction
在SLAVE接受到日志或超時之前,MASTER對SESSION的COMMIT請求不作返回響應;
The rolled-back transaction is logged even though it has no effect for transactional tables because the modifications to the nontransactional tables cannot be rolled back and must be sent to slaves.
滾回操作,即使對事務表沒有影響,也同樣會被記錄到日志里,因為“修改”會非事務表是不可回滾的,所以必須也傳輸到SLAVE;
對于自動提交的語句; MASTER將被在每個語句結束后BLOCK住;
## 幾個系統變量設置
rpl_semi_sync_master_enabled=1 # 打開MASTER支持semisynchronous replication
rpl_semi_sync_slave_enabled=1 # 打開Slave 支持semisynchronous replication
rpl_semi_sync_master_timeout # 等待SLAVE超時時間;1MS,默認10000MS
rpl_semi_sync_master_wait_no_slave # 在超時之前,如果SLAVE都DOWN了,是不是還繼續等待直到超時;默認打開 ;
## 幾個狀態變量
Rpl_semi_sync_master_status # 查看MASTER是否支持semisynchronous replication
Rpl_semi_sync_slave_status # 查看SLAVE 是否支持semisynchronous replication
Rpl_semi_sync_master_clients # 查看后面跟著幾個semisynchronous slaves
Rpl_semi_sync_master_yes_tx # 成功傳輸了多少個事務;
Rpl_semi_sync_master_no_tx # 失敗傳輸了多少個事務;
到此,關于“MySQL半同步SLAVE是什么”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。