机器master与机器slaver,由于master机器binlog目录迁移,由原来binlog目录(datadir一致),现迁移到一个新目录下。
操作如下:
1、master机器,flush logs
2、关闭master机器的服务
3、修改my.cnf中bin-log=mysql-bin 配置为 bin-log=/image_dsk/mysql_binlog/mysql-bin,
4、将最后一个binlog与mysql-bin.index两个文件一并,拷贝到新目录下(/image_dsk/mysql_binlog)。
5、启动master机器的服务master机器启动,运行良好。 slaver机器,复制报错,错误日志:
130522 20:09:04 [Note] Slave: received end packet from server, apparent master shutdown:
130522 20:09:04 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000051' at postion 107
130522 20:09:04 [ERROR] Slave I/O: error reconnecting to master '[email protected]:3306' - retry-time: 60  retries: 86400, Error_code: 2003
130522 22:00:05 [Note] Slave: connected to master '[email protected]:3306',replication resumed in log 'mysql-bin.000051' at position 107
130522 22:00:05 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
130522 22:00:05 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file', Error_code: 1236
130522 22:00:05 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000051', position 107说明:
1、原目录下日志与index都没有删除,master启动后的新的mysql-bin.index最后记录的日志,增加了绝对路径(/image_dsk/mysql_binlog/mysql-bin.XXXXXX)
2、更新master机器binlog目录,slaver机器上没有停止复制(stop slave)。

解决方案 »

  1.   

    切换binlog地址  没停stop slave啊那你切换binlog目录这段时间产生的更新岂不是要丢掉 重做slave吧
      

  2.   

    呵呵,就是忘记了。stop slave了。
    还有其它方法没有,不用重做。  
    观察slave的信息,只是部分日志没有写过来。
    其实问题是,原目录与新目录均有最后一个binlog数据,为什么它就会报错?(即使报错,也应该是在读取master启动后,新产生的日志)