MySQL 8.0 MGR 克隆技术

MySQL 8.0 MGR 克隆技术

8.0MGR克隆插件恢复节点流程

1.写节点建账号赋权

CREATE USER 'clone_user'@'%' IDENTIFIED BY 'clone123456';
GRANT BACKUP_ADMIN on *.* to 'clone_user'@'%';

在作为来源的节点安装clone插件

INSTALL PLUGIN clone SONAME '[mysql_clone.so](http://mysql_clone.so/)';

2.在新节点建账号赋权安装clone插件

CREATE USER 'clone_user'@'%' IDENTIFIED BY 'clone123456';

GRANT CLONE_ADMIN on *.* to 'clone_user'@'%';

INSTALL PLUGIN clone SONAME '[mysql_clone.so](http://mysql_clone.so/)';

指定来源节点IP和端口(到从节点上拉取数据)

SET GLOBAL clone_valid_donor_list = '172.30.0.19:6003';

插件安装:

install plugin group_replication soname '[group_replication.so](http://group_replication.so/)';

install plugin rpl_semi_sync_master soname '[semisync_master.so](http://semisync_master.so/)';

install plugin rpl_semi_sync_slave soname '[semisync_slave.so](http://semisync_slave.so/)';

exit

3.新节点登录克隆账号执行命令

mysql -uclone_user -p

CLONE INSTANCE FROM 'clone_user'@'172.30.0.19':6003 IDENTIFIED BY 'clone123456';

exit

4.新节点开启组复制并检查MGR集群状态

mysql -uroot -p

start group_replication;

select * from performance_schema.replication_group_members;

注意!新节点的my.cnf要预先设置好MGR相关内容否则无法打开组复制

CHANGE MASTER TO MASTER_USER='replication', MASTER_PASSWORD='RbHxkIfDmv4ReXHN' FOR CHANNEL 'group_replication_recovery';

注意:

在 做 start group_replication 操作之后,如果发现报错,注意查看报错信息,

show processlist; 之后发现有新的应用连接进来,导致产生了多的gtid事物,解决方法:

1.将连接的应用ip 暂时性加入防火墙

2.重做克隆

posted @ 2019-12-10 06:55  Carry00  阅读(166)  评论(0编辑  收藏  举报