MySQL Master/Slave failure Got fatal error 1236 Solution

Source: Internet
Author: User

The slave server reports an error due to the abnormal restart of the master server. The error is as follows:
Show slave status error:

mysql> show slave status\GMaster_Log_File: mysql-bin.000288Read_Master_Log_Pos: 627806304Relay_Log_File: mysql-relay-bin.000990Relay_Log_Pos: 627806457Relay_Master_Log_File: mysql-bin.000288Slave_IO_Running: NoSlave_SQL_Running: YesExec_Master_Log_Pos: 627806304Relay_Log_Space: 627806663

 

......Last_IO_Error: Got fatal error 1236 from master when  reading data from binary log:'Client requested master to start  replication from impossible position'

Mysql Error Log:

tail /data/mysql/mysql-error.log111010 17:35:49 [ERROR] Error reading packet from server: Client requested master to start replication from impossible position ( server_errno=1236)111010 17:35:49 [ERROR] Slave I/O: Got fatal error 1236 from master when reading datafrom binary log: 'Client requested master to start replication from impossibleposition', Error_code: 1236111010 17:35:49 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000288',position 627806304

According to the habit, first try to change the position.

mysql> stop slave;mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625751;mysql> start slave;

The error persists. log on to the master server to view the binlog log.
Search the master server log according to the error mark:

[root@db1 ~]# mysqlbinlog --start-position=627655136 /data/mysql/binlog/mysql-bin.000288/*!40019 SET @@session.max_insert_delayed_threads=0*/;/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;DELIMITER /*!*/;# at 4#111010 13:31:19 server id 4 end_log_pos 106 Start: binlog v 4, server v 5.1.45-logcreated 111010 13:31:19# Warning: this binlog is either in use or was not closed properly.BINLOG 'F1aTTg8EAAAAZgAAAGoAAAABAAQANS4xLjQ1LWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC'/*!*/;DELIMITER ;# End of log fileROLLBACK /* added by mysqlbinlog */;/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

The location is not displayed.

[Root @ db1 ~] #Mysql binlog/data/mysql/binlog/mysql-bin.000288> test.txtLess text.txt read the last part # at 627625495 #111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id = 45613333exec_time = 32758 error_code = 0 set timestamp = 1318289746 /*! */; Delete from freeshipping_bef_update where part = 'ar-4006WLM 'and code = ''/*! */; #627625631#111010 16:35:46 server id 1 end_log_pos627625751Query thread_id = 45613333exec_time = 32758 error_code = 0 set timestamp = 1318289746 /*! */; Delete from shippingFee_special where part = 'ar-4006WLM '/*! */; DELIMITER; # End of log fileROLLBACK/* added by mysqlbinlog */;/*! 50003 SET COMPLETION_TYPE = @ OLD_COMPLETION_TYPE */;

Find a position closest to error 627655136627625631.

Return to the Server Load balancer instance and change master to point postion to this location.

mysql> stop slave;Query OK, 0 rows affected (0.00 sec)mysql> change master to master_log_file='mysql-bin.000288',master_log_pos=627625631;Query OK, 0 rows affected (0.06 sec)mysql> start slave;Query OK, 0 rows affected (0.00 sec)

View again

mysql> show slave status\G*************************** 1. row ***************************Slave_IO_State: Queueing master event to the relay logMaster_Host: 192.168.21.105Master_User: repMaster_Port: 3306Connect_Retry: 10Master_Log_File: mysql-bin.000289Read_Master_Log_Pos: 25433767Relay_Log_File: mysql-relay-bin.000003Relay_Log_Pos: 630Relay_Master_Log_File: mysql-bin.000289Slave_IO_Running: YesSlave_SQL_Running: Yes

The master-slave synchronization is normal, and other slave machines are repaired in the same way.

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.