備份恢復##
1.從庫查詢狀態###
slave status
Master_Log_File: mysql-bin.000120
Slave_IO_Running: Yes
Slave_SQL_Running: No
RELAY_Master_Log_FILE: mysql-bin.000119
Exec_Master_Log_Pos: 87663322
Last_Error: xxxxx
這種狀態就是要從mysql-bin.000119 的87663322 行開始恢復,只能一點點比對了。
2.主庫查詢binlog###
show binlog events in 'mysql-bin.000119' from 87663322 limits 100000;
然后看卡在哪個事務上了。
3.從庫跳過錯誤的事務###
stop slave;
set GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
start slave;
然后回到步驟1 繼續找。如果每個事務都不長,可以調整SLAVE_SLAVE_SKIP_COUNTER的值一次跳過多個事務。
4.slave的過濾配置###
官方手冊 https://dev.mysql.com/doc/refman/5.7/en/replication-rules.html
按照官方建議,主庫的binlogxxx配置有一定作用,在從庫設置過濾規則可以讓斷開復制的幾率更小點。
replicate-wild-do-table = xyz.abc_%
類似這種,表名如果有_需要轉譯。跨庫的問題,只能注意了。
5.其它###
記錄些相關表
mysql.slave_master_info
mysql.slave_relay_log_info
mysql.slave_worker_info
performance_schema.replication_applier_configuration
performance_schema.replication_applier_filters
performance_schema.replication_applier_global_filters
performance_schema.replication_applier_status
performance_schema.replication_applier_status_by_coordinator
performance_schema.replication_applier_status_by_worker
performance_schema.replication_connection_configuration
performance_schema.replication_connection_status
performance_schema.replication_group_member_stats
performance_schema.replication_group_members