my.cnf
[mysql]prompt='node2 [\h] {\u} (\d) > '#[client]user = sapassword = cc.123port = 22113socket = /tmp/mysql_sandbox22113.sock [mysqld]user = rootport = 22113socket = /tmp/mysql_sandbox22113.sockbasedir = /usr/local/8.0.11datadir = /home/data/group_sp_msb_8_0_11/node2/datatmpdir = /home/data/group_sp_msb_8_0_11/node2/tmppid-file = /home/data/group_sp_msb_8_0_11/node2/data/mysql_sandbox22113.pidbind-address = 0.0.0.0report-port=22113log-error=msandbox.errserver-id=200relay-log-index=mysql-relayrelay-log=mysql-relaylog-bin=mysql-binlog-error=msandbox.errbinlog_checksum=NONElog_slave_updates=ONplugin-load=group_replication.sogroup_replication=FORCE_PLUS_PERMANENTgroup_replication_start_on_boot=OFFgroup_replication_bootstrap_group=OFFtransaction_write_set_extraction=XXHASH64report-host=127.0.0.1loose-group_replication_group_name="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"loose-group-replication-single-primary-mode=onmaster-info-repository=tablerelay-log-info-repository=tablegtid_mode=ONlog-slave-updatesenforce-gtid-consistencyloose-group-replication-local-address=127.0.0.1:22238loose-group-replication-group-seeds=127.0.0.1:22237,127.0.0.1:22238,127.0.0.1:22239,127.0.0.1:22240mysqlx-port=32113mysqlx-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,以此来区分整个内网里边的各个不的GROUPgroup_replication_local_address #本地的IP地址字符串,host:portgroup_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官方