异常关机,同时出现:Last_IO_Errno: 1236,Last_SQL_Errno: 1594

一主两从的结构,由于异常关机,导致两个从库都出现如下问题:

mysql> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 192.168.56.110
                  Master_User: replica
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: 561103306-bin.000007
          Read_Master_Log_Pos: 1250488
               Relay_Log_File: mysqld-relay-bin.000002
                Relay_Log_Pos: 1207291
        Relay_Master_Log_File: 561103306-bin.000007
             Slave_IO_Running: No
            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: 1594
                   Last_Error: Relay log read failure: 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.
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1250488
              Relay_Log_Space: 1207754
              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
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Client requested master to start replication from impossible position; the first event ‘561103306-bin.000007‘ at 1250488, the last event read from ‘./561103306-bin.000007‘ at 4, the last byte read from ‘./561103306-bin.000007‘ at 4.‘
               Last_SQL_Errno: 1594
               Last_SQL_Error: Relay log read failure: 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.
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 561103306
                  Master_UUID: 
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: 
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 141020 09:57:15
     Last_SQL_Error_Timestamp: 141020 09:57:15
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
1 row in set (0.00 sec)

当着两个问题同时出现时,先处理后面一个(errno:1594) ,再处理(error:1236)

 Last_SQL_Errno: 1594的处理方法:

mysql>stop slave ;

mysql> change master to master_log_file =‘561103306-bin.000007‘ ,master_log_pos = 1250488;

 Last_IO_Errno: 1236的处理方法:

# mysqlbinlog  561103306-bin.000007  >yyf.log

在yyf.log里面找离  1250488位置最近的事件,发现该日志最后一个pos是1248558,那就可以直接切到下一个log的开始位置即可:

mysql> stop slave;

mysql>  change master to master_log_file=‘561103306-bin.000008‘ ,master_log_pos=0;

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。