MySQL GTID複製中斷修復過程
slave中出現錯誤:
2020-04-09T07:40:18.719203Z 16 [ERROR] Slave SQL for channel '': Could not execute Write_rows event on table mytestdb.t1; Duplicate entry '6' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log mysql-bin.000050, end_log_pos 437, Error_code: 1062
2020-04-09T07:40:18.719237Z 16 [Warning] Slave: Duplicate entry '6' for key 'PRIMARY' Error_code: 1062
2020-04-09T07:40:18.719246Z 16 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000050' position 194.
這是由於我人為往表中製造了主鍵衝突
檢視slave的gtid資訊:
mysql> show global variables like '%gtid%';
+----------------------------------+---------------------------------------------------------------------------------------+
| Variable_name | Value |
+----------------------------------+---------------------------------------------------------------------------------------+
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| gtid_executed | 2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-6957,
3853efe2-5dc8-11ea-86cb-000c295618b3:1-2 |
| gtid_executed_compression_period | 1000 |
| gtid_mode | ON |
| gtid_owned | |
| gtid_purged | 2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-2 |
| session_track_gtids | OFF |
+----------------------------------+---------------------------------------------------------------------------------------+
檢視master的gtid資訊:
root@dv 15:40: : [(none)]>show global variables like '%gtid%';
+----------------------------------+---------------------------------------------+
| Variable_name | Value |
+----------------------------------+---------------------------------------------+
| binlog_gtid_simple_recovery | ON |
| enforce_gtid_consistency | ON |
| gtid_executed | 2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-6958 |
| gtid_executed_compression_period | 1000 |
| gtid_mode | ON |
| gtid_owned | |
| gtid_purged | 2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-2 |
| session_track_gtids | OFF |
+----------------------------------+---------------------------------------------+
設定從庫的gtid_next
mysql> SET GTID_NEXT="2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-6957";
ERROR 1774 (HY000): Malformed GTID specification '2ff0b1ed-5dc8-11ea-9878-000c29872e9a:1-6958'.
mysql> SET GTID_NEXT="2ff0b1ed-5dc8-11ea-9878-000c29872e9a:6957";
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
這裡是模擬一個事務,代替出錯的事務
mysql> SET GTID_NEXT="AUTOMATIC"
-> ;
Query OK, 0 rows affected (0.00 sec)
緊接著start slave即可
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-2685227/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【MySQL】主從GTID複製修復MySql
- MySQL GTID複製錯誤修復演示MySql
- MySQL GTID複製MySql
- MySQL 8 複製(四)——GTID與複製MySql
- MySQL 8 複製(五)——配置GTID複製MySql
- MySQL主從複製之GTID複製MySql
- 【Mysql】Mysql GTID複製程式出現異常,出現斷點MySql斷點
- MysqL主從複製_模式之GTID複製MySql模式
- mysql GTID 主從複製概述MySql
- MySQL 5.7.9多源複製報錯修復MySql
- Mysql基於GTID的複製模式MySql模式
- Mysql 基於GTID主從複製MySql
- mysql GTID主從複製故障後不停機恢復同步流程MySql
- 從庫誤刪資料後 gtid 複製斷開後的恢復
- MySQL 5.6 建立GTID主從複製 (GTID-based Replication)MySql
- MySQL主主複製(雙主複製)配置過程介紹MySql
- MySQL 傳統複製與 GTID 複製原理及操作詳解MySql
- MySQL 5.7 基於GTID搭建主從複製MySql
- MySQL8.0輕鬆搞定GTID組複製MySql
- MySQL 5.7基於GTID的主從複製MySql
- MySQL GTID複製的優缺點介紹MySql
- MySQL 5.7 使用GTID方式搭建複製環境MySql
- mysql之 MySQL 主從基於 GTID 複製原理概述MySql
- MYSQL匯入中斷處理過程MySql
- MySQL主從複製_複製過濾MySql
- MySQL8.0輕鬆搞定GTID主從複製MySql
- MySQL8.0輕鬆搞定GTID主主複製MySql
- 專案02(Mysql gtid複製故障處理01)MySql
- 【Mysql】傳統複製線上升級為GTID模式MySql模式
- MySQL運維實戰(7.1) 開啟GTID複製MySql運維
- 如何在不相容的DDL命令後修復MySQL複製MySql
- MariaDB GTID 複製同步
- MySQL主從複製的詳細過程介紹MySql
- MySQL恢復過程MySql
- MySQL 複製全解析 Part 9 一步步搭建基於GTID的MySQL複製MySql
- MySQL 複製全解析 Part10 基於GTID的MySQL複製的一些限制MySql
- Mysql 8.4.0 結合 Docker 搭建GTID主從複製,以及傳統主從複製MySqlDocker
- MySQL主從不一致的修復過程MySql