恢复
利用sql_therad独立完成。
1.创建空实例。
2.导入备份,例mysqldump的备份
3.设置gtid_purged,通过备份文件查找gtid.
-- GTID state at the beginning of the backup
--
SET @@GLOBAL.GTID_PURGED='cb181bfa-b71c-11e8-b976-c03fd53051da:1-3';
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000010', MASTER_LOG_POS=328;
------------------------------------------------------------------------------------
>reset master
>set global GTID_PURGED='cb181bfa-b71c-11e8-b976-c03fd53051da:1-3';
>show global variables like '%relay_log_basename%'
4.将主库(故障库)binlog拷贝到并重命名为 xxxx-relay-bin 并重构xxxx-relay-bin.index
5.change master to relay_log_file='xxxx-relay-bin.000010',relay_log_pos=328,masterhost='host01';
6.show slave status \G 查看Retrieved_Gtid_Set
7.通过解析binlog日志查找到故障操作gtid
mysqlbinlog -v --base64-output=decode-rows mysql-bin.000010
8.如果需要只恢复一张表设置过滤。
change replication filter replicate_do_table=(db1.a);
9.启动sql_thread到故障gtid
start slave sql_thread until sql_before_gtids='cb181bfa-b71c-11e8-b976-c03fd53051da:5';
10.show slave status 检查
11.检查表数据恢复。