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 8 複製(四)——GTID與複製MySql
- MySQL 8 複製(五)——配置GTID複製MySql
- Mysql基於GTID的複製模式MySql模式
- Mysql 基於GTID主從複製MySql
- mysql GTID主從複製故障後不停機恢復同步流程MySql
- MySQL 傳統複製與 GTID 複製原理及操作詳解MySql
- MySQL 5.7 基於GTID搭建主從複製MySql
- MySQL8.0輕鬆搞定GTID組複製MySql
- MySQL 5.7基於GTID的主從複製MySql
- MySQL運維實戰(7.1) 開啟GTID複製MySql運維
- 專案02(Mysql gtid複製故障處理01)MySql
- MySQL8.0輕鬆搞定GTID主從複製MySql
- MySQL8.0輕鬆搞定GTID主主複製MySql
- MySQL 複製全解析 Part10 基於GTID的MySQL複製的一些限制MySql
- 16.1.3 使用GTID 配置複製
- MySQL 複製全解析 Part 9 一步步搭建基於GTID的MySQL複製MySql
- Mysql 8.4.0 結合 Docker 搭建GTID主從複製,以及傳統主從複製MySqlDocker
- MySQL恢復過程MySql
- 如何在不相容的DDL命令後修復MySQL複製MySql
- Linux下MySQL主從複製(Binlog)的部署過程LinuxMySql
- MySQL主從複製歷程MySql
- 伺服器斷電Oracle資料庫修復資料過程伺服器Oracle資料庫
- Redis複製過程詳解Redis
- MySQL主從複製之GTID模式詳細介紹鞴嬈MySql模式
- 線上將傳統模式複製改為GTID複製模式模式
- MySQL資料庫INNODB表損壞修復處理過程分享MySql資料庫
- vim編輯過程中斷,恢復時出現警告
- MySQL 5.7傳統複製到GTID線上切換(一主一從)MySql
- mysql過濾複製的實現MySql
- redis建立主從複製的過程Redis
- 【PG流複製】Postgresql流複製部署過程及效能測試SQL
- MySQL 崩潰恢復過程分析MySql
- MySQL Xtrabackup真實生產環境搭建主從複製全過程MySql
- Linux下MySQL主從複製(GTID)+讀寫分離(ProxySQL)-實施筆記LinuxMySql筆記
- MySQL 組複製故障恢復的有效策略MySql
- GTID環境中手動修復主從故障一例(Error 1146)Error