在mysql 8.0版本中,mgr功能进行了很大的改善和增强,如果要部署组复制的服务器,实例必须满足以下条件:
基础设置:
1、InnoDB存储引擎
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
####由于存在冲突检测,冲突需要回滚事务,设置禁用其他的存储引擎
2、Primary Keys
Every table that is to be replicated by the group must have a defined primary key, or primary key equivalent where the equivalent is a non-null unique key.
####每个表都需要有主键或非null的唯一键
3、Network Performance
From MySQL 8.0.14, you can use an IPv4 or IPv6 network infrastructure, or a mix of the two, for TCP communication between remote Group Replication servers.
#####从8.0.14版本开始,可以支持IPV4和IPV6,两者也可以混用
实例配置:
1、Unique Server Identifier
#####唯一的server名字
server_id=1
2、Binary Log Active:
#####设置log_bin文件位置
log_bin=/data1/mgr/logs/mysql-bin
3、Replica Updates Logged:开启副本更新记录
#####开启副本更新,8.0.26版本之前
log_slave_updates=ON
#####8.0.26之后
log_replica_updates=ON
4、Binary Log Row Format
#####binlog日志的格式,8.0.14之后的默认格式
binlog_format=ROW
5、Binary Log Checksums Off
#####为解决网络不稳定或传输出错,导致主从服务器运行的sql不一致,增加的事务校验
binlog_checksum=NONE
#######5.7后的默认值,当启用后,每个事务都将进行校验,只将完整的事务写入二进制日志
binlog_checksum=CRC32
6、Global Transaction Identifiers On
#####开启gtid
gtid_mode=ON
#####基于gtid的复制,使用全局事务标识符来跟踪已提交到组中的每个服务器实例上的事务。
enforce_gtid_consistency=ON
7、Replication Information Repositories
#####默认值,确保group replication 可恢复性和复制元数据的事务性管理
master_info_repository=TABLE
relay_log_info_repository=TABLE
8、Transaction Write Set Extraction、Binary Log Dependency Tracking
#####基于组复制的检验方式
transaction_write_set_extraction=XXHASH64
#####默认commit_order,在并行复制有压力的情况下会形成一组
binlog_transaction_dependency_tracking=COMMIT_ORDER
9、Lower Case Table Names
#####设置大小写是否敏感
lower_case_table_names=1
10、Multithreaded Appliers
#####确保事务最终提交的顺序与原始相同
replica_preserve_commit_order=1
#####哪些事务在副本上执行
replica_parallel_type=LOGICAL_CLOCK
#####在副本上启用多线程
replica_parallel_workers=0