MySQL8.0.11 組複製配置

zping發表於2018-06-12

 my.cnf

[mysql]
prompt='node2 [\h] {\u} (\d) > '
#
[client]
user               = sa
password           = cc.123
port               = 22113
socket             = /tmp/mysql_sandbox22113.sock
[mysqld] user = root port = 22113 socket = /tmp/mysql_sandbox22113.sock basedir = /usr/local/8.0.11 datadir = /home/data/group_sp_msb_8_0_11/node2/data tmpdir = /home/data/group_sp_msb_8_0_11/node2/tmp pid-file = /home/data/group_sp_msb_8_0_11/node2/data/mysql_sandbox22113.pid bind-address = 0.0.0.0 report-port=22113 log-error=msandbox.err server-id=200 relay-log-index=mysql-relay relay-log=mysql-relay log-bin=mysql-bin log-error=msandbox.err binlog_checksum=NONE log_slave_updates=ON plugin-load=group_replication.so group_replication=FORCE_PLUS_PERMANENT group_replication_start_on_boot=OFF group_replication_bootstrap_group=OFF transaction_write_set_extraction=XXHASH64 report-host=127.0.0.1 loose-group_replication_group_name="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" loose-group-replication-single-primary-mode=on master-info-repository=table relay-log-info-repository=table gtid_mode=ON log-slave-updates enforce-gtid-consistency loose-group-replication-local-address=127.0.0.1:22238 loose-group-replication-group-seeds=127.0.0.1:22237,127.0.0.1:22238,127.0.0.1:22239,127.0.0.1:22240 mysqlx-port=32113 mysqlx-socket=/tmp/mysqlx-32113.sock

 

關於MGR相關引數說明
transaction_write_set_extraction #記錄事務的演算法
group_replication_start_on_boot #是否隨伺服器啟動而自動啟動組複製
group_replication_bootstrap_group #引導組成員的組,這個用於第一次搭建MGR跟重新搭建MGR的時候使用
group_replication_group_name  #此GROUP的名字,必須是一個有效的UUID,以此來區分整個內網裡邊的各個不的GROUP
group_replication_local_address #本地的IP地址字串,host:port
group_replication_group_seeds  #需要接受本例項的資訊伺服器IP地址字串
group_replication_single_primary_mode #是否啟動單主模式,如果啟動,則本例項是主庫,提供讀寫,其他例項僅提供讀
group_replication_enforce_update_everywhere_checks #多主模式下,強制檢查每一個例項是否允許該操作

 

loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" #叢集名稱

loose-group_replication_start_on_boot=off #是否隨著服務啟動叢集

loose-group_replication_local_address= "127.0.0.1:3011" #叢集本機埠,和服務埠不同

loose-group_replication_group_seeds= "127.0.0.1:3013,127.0.0.1:3012,127.0.0.1:3011" #叢集包含的所有節點

loose-group_replication_bootstrap_group= off #是否設定為主節點,當建立叢集時其他加入的節點都以該節點為目標加入叢集

 

PRIMARY MEMBER_ROLE

change master to 
        master_user='rpl_user',
        master_password='123456'
        for channel 'group_replication_recovery';

-- install plugin group_replication soname 'group_replication.so';

set global group_replication_bootstrap_group=on;
start group_replication;
set global group_replication_bootstrap_group=off;

其他節點

change master to 
        master_user='rpl_user',
        master_password='123456'
        for channel 'group_replication_recovery';

-- install plugin group_replication soname 'group_replication.so';

#非seed結點直接start group_replication 就行
start group_replication;

 下圖來自MySQL官方

 

相關文章