MySQL Replication Error (1062)

I am new to MySQL and after a long search I can configure ROW based replication based on slave. I thought it would be safe and I would not have to repeat it again and again.

But today, when I did SHOW SLAVE STATUS;on slave, I found the following

Failed to execute the Write_rows table mydatabasename.atable event; duplicate record "174465" for the key "PRIMARY", Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; events master log mysql-bin.000004, end_log_pos 60121977

Can someone tell me how this can happen when the owner does not have such an error, and the scheme on both servers is the same, whereas this could happen. And how to fix it, to do this work again and how to prevent such a thing in the future.

Please let me know what else I expect, besides this.

+3
source share
2 answers

It will never happen on the host, why?

The SQL series is replicated from the master,
if the record already exists in master, mysql reject to master

but on the subordinate, if it fails, and the replication position did not move to the next SQL (it just stopped)

Cause?

The insert request for this record is written directly to the slave without using replication from the wizard

How to fix?

Skip error on slave, e.g.

SET GLOBAL sql_slave_skip_counter = N;

details - http://dev.mysql.com/doc/refman/5.0/en/set-global-sql-slave-skip-counter.html

, ( )

, .

?

, ,
, mysql

mysql, ,
, ( ), .
( ) .

+6

Source: https://habr.com/ru/post/1784935/


All Articles