MySQL Replication Error 1032 & amp; 1052

Source: Internet
Author: User

MySQL Replication is usually used for MySQL services for read/write splitting, HA, hot backup, or incremental operations, and the Master/Slave mechanism is indispensable.

However, errors 1032 and 1052 are reported in many cases.

First 1032.

Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;

The root cause of the 1032 error is the inconsistency between the master and slave databases, which causes the synchronization operation to fail on the slave database.

Currently, I have two situations:

1. During Replication, the master -- binlog-ignore-db = db_name or -- replicate-ignore-db = db_name is used.

Assume that there are two databases pubs and test, and test is ignored. The result is that an SQL statement is executed in the test database on the master database: insert into pubs. tname values (XXXXX );

The master node is successfully executed based on the service configuration. If the master node is not executed, the error 1032 is returned.

2. If the versions of TRIGGER and PROCEDURE are different, for example, a PROCEDURE on the master node writes 5 data records after execution, but only one row of data is written after execution, at this time, the 1032 error will inevitably occur.

Solution:

1 do not use -- binlog-ignore-db and -- replicate-ignore-db = db_name

Change from -- replicate-wild-ignore-table = db_name. %

2. Ensure that the versions of the master-slave TRIGGER and PROCEDURE are consistent.

Let's talk about 1052:

This error is easy to understand. Generally, the Operation connection on the master node is autocommit. As a result, the operation times out and fails. An error will be reported when synchronizing data from the database.

Two methods:

1. Set my. cnf innodb_rollback_on_timeout = 1 on the master and rollback upon timeout.

2. Ignore the 1052. my. cnf -- slave-skip-errors = 1052

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.