db1 is master and db2/db3 is db1's slave CREATE TABLE `table1` ( `id` int(11) NOT NULL AUTO_INCREMENT, `date` datetime NOT NULL, `info` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL, `test_info` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'test', `INF` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, PRIMARY KEY (`id`,`date`,`info`) ) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci db3 (root@localhost) [(none)] 18:31:43> show variables like '%gtid%'; +-------------------------+----------------------------------+ | Variable_name | Value | +-------------------------+----------------------------------+ | gtid_binlog_pos | 111-12-613 | | gtid_binlog_state | 111-13-602,111-11-402,111-12-613 | | gtid_cleanup_batch_size | 64 | | gtid_current_pos | 111-12-613 | | gtid_domain_id | 111 | | gtid_ignore_duplicates | ON | | gtid_pos_auto_engines | | | gtid_seq_no | 0 | | gtid_slave_pos | 111-12-613 | | gtid_strict_mode | ON | | last_gtid | | | wsrep_gtid_domain_id | 1 | | wsrep_gtid_mode | ON | +-------------------------+----------------------------------+ 13 rows in set (0.01 sec) on master db1 insert some records mysql -ureplication -preplication -h172.137.254.21 -P3306 tt -e " set autocommit=0;begin; insert into table1(date,info,test_info,INF) VALUES ('2021-12-30','m$i',$i,111);insert into table1(date,info,test_info,INF) VALUES ('2021-12-30','m$i',$i,111);commit;" (root@localhost) [(none)] 18:32:42> show variables like '%gtid%'; +-------------------------+----------------------------------+ | Variable_name | Value | +-------------------------+----------------------------------+ | gtid_binlog_pos | 111-11-623 | | gtid_binlog_state | 111-13-602,111-12-613,111-11-623 | | gtid_cleanup_batch_size | 64 | | gtid_current_pos | 111-11-623 | | gtid_domain_id | 111 | | gtid_ignore_duplicates | ON | | gtid_pos_auto_engines | | | gtid_seq_no | 0 | | gtid_slave_pos | 111-11-623 | | gtid_strict_mode | ON | | last_gtid | | | wsrep_gtid_domain_id | 1 | | wsrep_gtid_mode | ON | +-------------------------+----------------------------------+ 13 rows in set (0.00 sec) change master from db1 to db2 (root@localhost) [(none)] 18:34:08> CHANGE MASTER TO -> MASTER_HOST='172.137.254.22', -> MASTER_USER='replication', -> MASTER_PASSWORD='replication', -> MASTER_PORT=3306, -> MASTER_USE_GTID=slave_pos; Query OK, 0 rows affected (0.01 sec) (root@localhost) [(none)] 18:34:11> start slave; Query OK, 0 rows affected (0.00 sec) (root@localhost) [(none)] 18:34:15> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 172.137.254.22 Master_User: replication Master_Port: 3306 Connect_Retry: 10 Master_Log_File: BINLOG.000003 Read_Master_Log_Pos: 5749 Relay_Log_File: RELAY.000002 Relay_Log_Pos: 667 Relay_Master_Log_File: BINLOG.000003 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1062 Last_Error: Could not execute Write_rows_v1 event on table tt.table1; Dupl icate entry '22-2021-12-30 00:00:00-m1' for key 'PRIMARY', Error_code: 1062; handler error HA_ ERR_FOUND_DUPP_KEY; the event's master log BINLOG.000003, end_log_pos 877 Skip_Counter: 0 Exec_Master_Log_Pos: 371 Relay_Log_Space: 3169 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1062 Last_SQL_Error: Could not execute Write_rows_v1 event on table tt.table1; Dupl icate entry '22-2021-12-30 00:00:00-m1' for key 'PRIMARY', Error_code: 1062; handler error HA_ ERR_FOUND_DUPP_KEY; the event's master log BINLOG.000003, end_log_pos 877 Replicate_Ignore_Server_Ids: Master_Server_Id: 12 Master_SSL_Crl: Master_SSL_Crlpath: Using_Gtid: Slave_Pos Gtid_IO_Pos: 111-11-623 Replicate_Do_Domain_Ids: Replicate_Ignore_Domain_Ids: Parallel_Mode: conservative SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave_DDL_Groups: 1 Slave_Non_Transactional_Groups: 0 Slave_Transactional_Groups: 20 1 row in set (0.00 sec)