Chinaunix首页 | 论坛 | 博客
  • 博客访问: 326560
  • 博文数量: 103
  • 博客积分: 1590
  • 博客等级: 上尉
  • 技术积分: 1075
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-02 10:17
文章分类

全部博文(103)

文章存档

2013年(32)

2012年(7)

2010年(64)

我的朋友

分类: Mysql/postgreSQL

2010-04-12 22:42:33

 

无法读取master上的log
  • 现象1
show slave status显示以下错误信息
   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
  • 原因
    • 在传输master log-bin时,因网络原因或slave机压力问题,造成log-relay文件格式错误
  • 解决
    1. 找到relay-log.info,第一行记录了当前正在执行的log-relay文件名
    2. 找到该文件的下一个文件
    3. 使用mysqlbinlog查看该文件,在#98这行有Rotate to log-bin.000004 pos: 4等信息,这就是目前slave停止的位置
    4. 在slave上重新指定同步位置,方法见CHANGE MASTER TO

步骤:

#>show slave status\G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: xx.xxx.218
                Master_User: fbrep
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: fb-bin.000092
        Read_Master_Log_Pos: 656277404
             Relay_Log_File: fb-relay.000356
              Relay_Log_Pos: 581305814
      Relay_Master_Log_File: fb-bin.000092
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB: fb,fb
        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 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: 1
        Exec_Master_Log_Pos: 131  (有时好象不对,所以特别小时要小心)
            Relay_Log_Space: 656280278
            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.info 及relay.info ,

方法1: 记下Relay_Master_Log_File: fb-bin.000092,   Exec_Master_Log_Pos: 131  (有时好象不对,所以特别小时要小心).  

change master to MASTER_LOG_FILE='fb-bin.000092' , MASTER_LOG_POS=131 (这样pos特别小有时会不对,用方法2)

方法2:          

cat master.info   ##
14
fb-bin.000092
657927031
xx.xx.44.218
fbrep
4rep0u1y
3306
60
0
##
[root@TJSJHL212-128 message2.kdb var]# cat relay-log.info
./fb-relay.000356
581305814
fb-bin.000092
131
05549
5
##
# mysqlbinlog fb-relay.000357 | more

/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
# at 4
#100412 15:50:58 server id 200128 end_log_pos 98       Start: binlog v 4, server v 5.0.27-standard-log created 100412 15:50:58
# at 98
#700101 8:00:00 server id 16218 end_log_pos 0         Rotate to fb-bin.000092 pos: 581305707

#
change master:

change master to master_host='xx.xx.218',MASTER_USER='xx',MASTER_PASSWORD='xx',
    -> master_port=3306,MASTER_LOG_FILE='fb-bin.000092',MASTER_LOG_POS=581305707;

阅读(1137) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~