MGR單主之自增序列參數設置

一、官網說明
When Group Replication is started on a server, the value of auto_increment_increment is changed to the value of group_replication_auto_increment_increment, which defaults to 7, and the value of auto_increment_offset is changed to the server ID. The changes are reverted when Group Replication is stopped. These settings avoid the selection of duplicate auto-increment values for writes on group members, which causes rollback of transactions. The default auto increment value of 7 for Group Replication represents a balance between the number of usable values and the permitted maximum size of a replication group (9 members).

The changes are only made and reverted if auto_increment_increment and auto_increment_offset each have their default value of 1. If their values have already been modified from the default, Group Replication does not alter them. From MySQL 8.0, the system variables are also not modified when Group Replication is in single-primary mode, where only one server writes.

敲黑板,劃重點,在MySQL8.0的版本中,組複製在單主模式下(只有一個寫服務器),系統變量(自增序列參數)是不會自動修改的。這是新版本中增加的一段話,我也是在測試中發現了了這個問題,在官網中得到了證實。知識就是知識或者別人告訴你,或者你自己找答案,找答案的過程是很有意思的。

二、驗證過程
1、系統默認參數
MGR單主之自增序列參數設置

2、自增序列表,自增是按照默認參數自增的,並沒有修改
MGR單主之自增序列參數設置

三、建議
1、建議大家還是用MGR中的單主模式
2、要對你要修改的每一個參數瞭如指掌,不然就不要改動。
3、紙上得來終覺淺,多做測試和實驗也要多分享。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章