Welcome 微信登录

首页 / 数据库 / MySQL / MySQL主从失败错误Got fatal error 1236解决方法

由于主服务器异外重启, 导致从报错, 错误如下:
show slave status错误:mysql> show slave statusGMaster_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错误日志: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按照习惯, 先尝试必改position位置.mysql> stop slave;mysql> change master to master_log_file="mysql-bin.000288",master_log_pos=627625751;mysql> start slave;错误依旧, 接下来登陆到主服务器查看binlog日志.
先按照错误点的标记去主服务器日志中查找:[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*/;没有看到这个位置.[root@db1 ~]# mysqlbinlog /data/mysql/binlog/mysql-bin.000288 > test.txtless text.txt看最后一部分# at 627625495#111010 16:35:46 server id 1 end_log_pos 627625631 Query thread_id=45613333exec_time=32758 error_code=0SET TIMESTAMP=1318289746/*!*/;delete from freeshipping_bef_update where part="AR-4006WLM" and code=""/*!*/;# at 627625631#111010 16:35:46 server id 1 end_log_pos 627625751 Query thread_id=45613333exec_time=32758 error_code=0SET 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*/;找到最接近错误标记627655136的一个position是627625631.再回到slave机器上change master, 将postion指向这个位置.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)再次查看mysql> show slave statusG*************************** 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主从同步正常了, 同样的方法修复其它slave机器.Oracle的拆分组合查询Linux平台下Oracle删除redolog仍然正常使用的原因相关资讯      MySQL数据库教程 
  • MySQL 处理非法数据  (04/09/2013 08:06:28)
  • MySQL关于timestamp和mysqldump的  (12/16/2012 13:25:41)
  • MySQL保证数据完整性  (12/16/2012 12:00:35)
  • ERROR 1130: mysql 1130连接错误的  (12/16/2012 13:29:08)
  • MySQL数据库教程:管理数据库和表(  (12/16/2012 12:47:02)
  • MySQL快速插入大批量数据存储过程  (11/05/2012 19:04:04)
本文评论 查看全部评论 (0)
表情: 姓名: 字数