Q&A:html
MySQl報錯之@@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_MODE = ONnode
導入的時候加入-f參數便可 緣由分析:導出原系統開啓GTID模式,而導入庫沒有開啓GTID模式
Q&A:mysql
ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.sql
【解決方案】 方法一:reset mater 這個操做能夠將當前庫的GTID_EXECUTED值置空 方法二:--set-gtid-purged=off 在dump導出時,添加--set-gtid-purged=off參數,避免將gtid信息導出
Q&A:app
Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ad904b26-5128-11e9-92eb-0242c0a80015:3' at master log binlog.000005, end_log_pos 975. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.工具
【解決方案】 查看形成問題的SQL: mysqlbinlog --no-defaults --base64-output=DECODE-ROWS --verbose node2-relay-bin.000002 > /tmp/mysqlbin.log 方法一: STOP SLAVE; SET @@SESSION.GTID_NEXT = '8fc8d9ac-a62b-11e6-a3ee-a4badb1b4a00:7649'; BEGIN; COMMIT; SET @@SESSION.GTID_NEXT = AUTOMATIC; START SLAVE; 方法二: ##GTID模式下的複製,sql_slave_skip_counter是不支持的 set global slave_exec_mode='IDEMPOTENT';##設置成IDEMPOTENT模式可讓從庫避免1032(從庫上不存在的鍵)和1062(重複鍵,須要存在主鍵或則惟一鍵)的錯誤,該模式只有在ROW EVENT的binlog模式下生效,在STATEMENT EVENT的binlog模式下無效 stop slave; start slave; set global slave_exec_mode='STRICT'; 參考來源:http://www.cnblogs.com/zhoujinyi/p/8035413.html 再經過pt-table-checksum和 pt-table-sync作數據一致性處理 建立檢查帳號: GRANT SELECT, PROCESS, SUPER, REPLICATION SLAVE,CREATE,DELETE,INSERT,UPDATE ON *.* TO 'pt_checksum' IDENTIFIED BY '1qaz!QAZ'; 檢查是否有差別: pt-table-checksum h='192.168.0.21',u='pt_checksum',p='1qaz!QAZ',P=3306 -d gtid --tables=t --nocheck-replication-filters --replicate=percona.checksums --no-check-binlog-format --[no]check-binlog-format #默認會檢查binlog-format,若是不是statment,就會報錯退出,想避免該檢查能夠設置--no-check-binlog-format --replicate #用來指定存放計算結果的表名, 默認是percona.checksums,工具會默認自動建立庫percona和表checksums並將checksum的檢查結果輸入到這個表中 --[no]check-replication-filters #默認在檢查到在主從複製過程當中有被用..ignore..過濾掉的表,檢查會中斷並退出,若是想避開這個檢查能夠設置--no-check-replication-filters 參考來源:https://www.cnblogs.com/xiaoyanger/p/5584554.html 咱們使用pt-table-sync工具還同步這張表的數據: pt-table-sync --charset=utf8 --print --no-check-slave -d gtid -t t h=192.168.0.21,u='pt_checksum',p='1qaz!QAZ',P=3306 h=192.168.0.22,u='pt_checksum',p='1qaz!QAZ',P=3306 ##前面填主庫的內容,後面填從庫的內容 --no-check-slave #不檢查desitination是否爲從庫 --print #打印差別變動語句 --execute #執行差別變動語句 執行變動能夠直接執行差別變動SQL或者經過如下語句執行: pt-table-sync --charset=utf8 --execute --no-check-slave -d gtid -t t h=192.168.0.21,u='pt_checksum',p='1qaz!QAZ',P=3306 h=192.168.0.22,u='pt_checksum',p='1qaz!QAZ',P=3306 注意:若是是sync主從數據,只有當須要sync的表都有惟一鍵(主鍵或惟一索引),才能使用--sync-to-master and/or --replicate。(沒有惟一鍵,則只能在desitination上直接修改,而指定--sync-to-master and/or –replicate時只能在主庫上修改), 若是sync主從時沒有指定--replicate或者--sync-to-master則全部修改都在從庫上執行(不論表上是否有惟一鍵)