• notice
  • Congratulations on the launch of the Sought Tech site

MysqlslaveRelay_log damage repair process

Time: 2013-04-18 11:32

Failure: The database server restarts for no reason.When the slave starts, it reports that the relay_log is damaged, and the SQL thread cannot be executed.

Cause of failure: OS restart may cause relay_log to fail to synchronize properly

The solution at this time is to re-change the master to, but the master log pos uses Exec_Master_Log_Pos (show slave statusG variable output) to re-accept data from the position where the slave has been executed.

I thought everything was ok, but a duplicate key error was reported on the slave.After that, it is conceivable to set sql_slave_skip_counter=1 to keep skipping.

The reason for the duplicate key is explained as a problem with MYSQL itself

Slave committing transaction and updating replication information is not atomic:

I/O thread synchronization: For relay log flushing to disk, and updating master.info are fsync calls respectively.

A duplicate event may be accepted if:

The server refreshes the relay_log and is about to update the master read position of the master.info file, but the server is down and the master.info is not updated, which causes the replication to start and causes the events to repeat.

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

The event has been applied on the database, but relay-log.info has not been updated.When recovering, SQL repeats certain events.

This article is from the blog "Technology Achieves Dreams", please be sure to keep this source http://weipengfei.blog.51cto.com/1511707/1180913


Technical otaku

Sought technology together

Related Topic


Leave a Reply