【MySQL】mysql5.7マルチソースコピーエラー問題処理

2569 ワード

シーン:
Master1
Master2
multi-slave
host:port
192.168.9.78:4001
testdba-mysql56.rdsm2wctkd8fa14.rds.bj.baidubce.com:3306
192.168.9.144:5000
uuid
b3ac499d-6662-11e9-be7e-005056877607
1e345bf9-32a4-11ea-b269-fa163ee30083
8ef26d45-82df-11ea-85b4-00505687de1b
レプリケーションdb
Slavedb01
dba_test01
質問1:あるチャンネルのエラーをスキップ
1、gtidモード
方法1:
stop slave for channel 'master_mysql9784001'; 
set gtid_next='b3ac499d-6662-11e9-be7e-005056877607:10';
begin;commit;set gtid_next='automatic';
start slave for channel 'master_mysql9784001'; 
show slave status\G

方式2:(代価が大きすぎて一般的には採用しない)
(1)エラーが報告されたチャネルの実行された位置点の表示
--     channel        
Retrieved_Gtid_Set: b3ac499d-6662-11e9-be7e-005056877607:2-9
Executed_Gtid_Set: 1e345bf9-32a4-11ea-b269-fa163ee30083:1-2224,
8ef26d45-82df-11ea-85b4-00505687de1b:1,
b3ac499d-6662-11e9-be7e-005056877607:1-7

(2)すべてのslaveレプリケーションを停止し、実行したgtidの位置を表示して記録する
--     slave  
stop slave;
--          gtid   
show master status; 
*************************** 1. row ***************************
 File: mysql-bin.000001
 Position: 422144
 Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 1e345bf9-32a4-11ea-b269-fa163ee30083:1-2320,
8ef26d45-82df-11ea-85b4-00505687de1b:1,
b3ac499d-6662-11e9-be7e-005056877607:1-7

(3)gtidのポイントを再設定する
--    gtid  
reset master;
set @@GLOBAL.GTID_PURGED="1e345bf9-32a4-11ea-b269-fa163ee30083:1-2320,b3ac499d-6662-11e9-be7e-005056877607:1-8";

(4)複製を開く
start slave;
show slave status; --   channel      

2、fileposモード:
スキップするチャンネルを止めてgtidモードを使わないステップ
--  :
1. mysql> stop slave for channel 'channel name';
2. mysql> set global sql_slave_skip_counter=1;
3. mysql> start slave for channel 'channel name';
​
--    start slave;    :
ERROR 3086 (HY000): When sql_slave_skip_counter> 0, it is not allowed to start more than one SQLthread by using 'START SLAVE [SQL_THREAD]'. Value ofsql_slave_skip_counter can only be used by one SQL thread at atime. Please use 'START SLAVE [SQL_THREAD] FOR CHANNEL' to startthe SQL thread which will use the value ofsql_slave_skip_counter.
        ,   sql_slave_skip_counter       sqlthread   

質問2:上流マスター2からマスター切り替え
1、gtidモード
人為的なアクセスを必要とせず、同期はエラーを報告せず、自動的に新しいmasterのgtidを取得する.
2、fileposモード
新しいマスターのfile、posの位置が変更されました.新しいレプリケーションポイントを変更する必要があります.