/ 2019-09-16
创建复制用户
mysql -S /data/3307/mysql.sock
set sql_log_bin=0;
grant replication slave,replication client on *.* to repl@'localhost' identified by '123';
grant replication slave,replication client on *.* to repl@'127.0.0.1' identified by '123';
grant replication slave,replication client on *.* to repl@'192.168.29.%' identified by '123';
SET SQL_LOG_BIN=1;
注:如果为三台独立节点,需要将localhost、127.0.0.1和远程主机域都授权用户
开启分布式复制
change master to master_user='repl',master_password='123' for channel 'group_replication_recovery';
加载GR插件
install plugin group_replication soname 'group_replication.so';
show plugins;
启动复制程序
start group_replication;
#检测组是否创建并已加入新成员
select * from performance_schema.replication_group_members;
注: 前面的用户密码修改和创建用户操作必须设置binlog不记录,执行后再打开,否则会引起START GROUP_REPLICATION执行报错:
ERROR 3092 (HY000): The server is not configured properly to be an active member of the group. Please see more details on error log.
解决方案是:根据提示打开group_replication_allow_local_disjoint_gtids_join选项,mysql命令行执行:
mysql> set global group_replication_allow_local_disjoint_gtids_join=ON;
然后再执行:
mysql> start group_replication;
创建复制用户
mysql -S /data/3308/mysql.sock
set sql_log_bin=0;
grant replication slave,replication client on *.* to repl@'localhost' identified by '123';
grant replication slave,replication client on *.* to repl@'127.0.0.1' identified by '123';
grant replication slave,replication client on *.* to repl@'192.168.29.%' identified by '123';
set sql_log_bin=1;
注:如果为三台独立节点,需要将localhost、127.0.0.1和远程主机域都授权用户
开启分布式复制
change master to master_user='repl',master_password='123' for channel 'group_replication_recovery';
加载GR插件
install plugin group_replication soname 'group_replication.so';
show plugins;
启动复制程序
start group_replication;
#检测组是否创建并已加入新成员
select * from performance_schema.replication_group_members;
(0)