MySQL Slave relay_log repair

Source: Internet
Author: User

Time:

Fault: the database server is restarted without reason. When the Slave is started, the relay_log is damaged, and the SQL thread cannot proceed.

Cause of failure: OS restart may cause relay_log to fail to be synchronized normally

In this case, the solution is to re-change the master to, but the master log pos uses Exec_Master_Log_Pos (show slave status \ G variable output) to re-Accept data from the location where the slave has been executed.

I thought everything was okay, but the duplicate key error was reported on the slave. Then I can imagine that the SQL _slave_skip_counter = 1 was skipped.

The reason for duplicate key is that MYSQL itself is a problem.

Slave does not perform atomic operations to commit transactions or update replication information:

I/O thread synchronization: fsync calls refresh the relay log to the disk and update master.info respectively.

The following situations may cause repeated acceptance events:

Server refresh relay_log. When the master reading location of the master.info file is being updated, the server goes down and master.info is not updated, which leads to repeated events when replication is started.

SQL thread synchronization: the SQL thread first submits the transaction to the storage engine, and then updates the relay_log.info file.

Events have been applied on the database, but relay-log.info is not updated. When it is restored, the SQL statement repeats some events.

Related Article

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.