MySQL Group Replication(多主同步複製MGR)

來源:互聯網
上載者:User

標籤:copy   mysql   自動啟動   install   ddr   分享圖片   執行   code   src   

開啟replication配置:

server-id=1                                      #識別服務器唯一

 log-bin=mysql-bin                           #二進位日誌開啟

enforce_gtid_consistency = ON          #GTID模式是組複製的基礎技術

 binlog-format=row                           #必須是ROW模式

 gtid-mode=ON                                  #GTID保證事物編號全域唯一   (Global Transaction ID)

master-info-repository=TABLE

relay-log-info-repository=TABLE           #記錄同步的資訊,便於管理和恢複

log-slave-update = ON                         #需要記錄事務的binlog,用作以後的恢複用,哪怕不是寫入點,也需要

binlog-checksum=NONE                      #MGR本身不支援binlog的checksum校正

開啟組配置:

transaction_write_set_extraction = XXHASH64                       #雜湊演算法loose-group_replication_group_name = "00e575aa-0cc0-11e8-9186-0050569341db"    # 組名,格式loose-group_replication_start_on_boot = off    # 在mysqld啟動時不自動啟動組複製loose-group_replication_local_address = "10.103.16.31:24901"              #原生IP地址及連接埠loose-group_replication_group_seeds = "10.103.16.34:24901,10.103.16.35:24901,10.103.16.31:24901"          #其他機器的IP及連接埠,形成一個組loose-group_replication_bootstrap_group = off 

主執行:

CHANGE MASTER TO MASTER_USER=‘stemp‘, MASTER_PASSWORD=‘123456‘ FOR CHANNEL ‘group_replication_recovery‘;INSTALL PLUGIN group_replication SONAME ‘group_replication.so‘;set global group_replication_allow_local_disjoint_gtids_join=ON;START GROUP_REPLICATION;

其他主執行:
INSTALL PLUGIN group_replication SONAME ‘group_replication.so‘;START GROUP_REPLICATION;

查看節點資訊:
select * from performance_schema.replication_group_members;
線上修改節點資訊:
set global group_replication_group_seeds=‘‘;



設定多主模式:

SERVER2,SERVER3:

STOP GROUP_REPLICATION;SET GLOBAL group_replication_single_primary_mode=FALSE;SET GLOBAL group_replication_enforce_update_everywhere_checks=TRUE;

SERVER1:

STOP GROUP_REPLICATION;SET GLOBAL group_replication_single_primary_mode=FALSE;SET GLOBAL group_replication_enforce_update_everywhere_checks=TRUE;SET GLOBAL group_replication_bootstrap_group=on;START GROUP_REPLICATION;SET GLOBAL group_replication_bootstrap_group=off;

然後SERVER2,SERVER3:

SET GLOBAL group_replication_bootstrap_group=on;START GROUP_REPLICATION;SET GLOBAL group_replication_bootstrap_group=off;





MySQL Group Replication(多主同步複製MGR)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.