[ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error

错误日志:

[ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
081127 17:31:41 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error
081127 17:31:41 [ERROR] Slave: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 0
081127 17:31:41 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysqlbinlog.000029' position 1041039187

version: 5.0.67 win2003

这种错误如何确认其原因?

能否通过下面方式跳过?
mysql> SET GLOBAL SQL_slave_SKIP_COUNTER =1;

mysql> START SLAVE SQL_THREAD ;

Taxonomy upgrade extras:

mysql> show slave status\G
Slave_IO_State: Waiting for master to send event
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysqlbinlog.000034
Read_Master_Log_Pos: 812942478
Relay_Log_File: svctag-7ddrh2x-relay-bin.000081
Relay_Log_Pos: 1041039326
Relay_Master_Log_File: mysqlbinlog.000029
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted
(you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by runnin
g 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the mas
ter's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
Skip_Counter: 0
Exec_Master_Log_Pos: 1041039187
Relay_Log_Space: 6182924999
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL

试图查看当时信息,进行如下操作:
mysql\bin>mysqlbinlog --start-position=1041039187 --stop-position=1041039326 -f ..\data\svctag-7ddrh2x-relay-bin.000081
>test.txt
ERROR: Error in Log_event::read_log_event(): 'read error', data_len: 808532036, event_type: 67
Could not read entry at offset 1041039187:Error in log format or read error

如何找出错误原因?有点晕

同样的语句在主数据库可以运行,内容如下:

/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 1041039187
#081121 11:19:00 server id 1 end_log_pos 1041039461 Query thread_id=39647 exec_time=0 error_code=0
use survey/*!*/;
SET TIMESTAMP=1227237540/*!*/;
SET @@session.pseudo_thread_id=39647/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/;
/*!\C gbk *//*!*/;
SET @@session.character_set_client=28,@@session.collation_connection=28,@@session.collation_server=28/*!*/;
insert into Temporary_Table_c values ( NAME_CONST('v_c_id',_binary 0x4D5A6C93EBD8102B8FDD9FB6B35FC1A8), NAME_CONST('childId',_binary 0x8CAAAA070360102C97F57EB924883D9B), NAME_CONST('v_aggregate_info',93), 0)
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

因此能说明从数据库的binlog文件有问题,具体是因为网络原因引起的?

如果跳过这个错误,如何确定从哪开始跳? 相应的命令是什么? 谢谢!

请先确认master上的binlog是否已损坏。如果已损坏,那么在slave上用 CHANGE MASTER TO 语法修改slave的状态,从下一个binlog开始,或者重新制做一个slave。如果没损坏,那么仍然用上面的语法重新指定log_file和log_pos,重新开始复制。

MySQL方案、培训、支持