处理slave(低版本)复制master(高版本)产生的error 1236

背景知识:

mysql 5.6里加入了replication event checksum(主从复制事件校验)功能,此特性能较为容易的判断出是由何种原因导致的主从数据不一致。

处理过程:

// 因某些特别的需求,需要对一台mysql 5.6的master配置一个mysql 5.5的slave(不推荐)。

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status \G
*************************** 1. row ***************************
......
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
......           
        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: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'mysql-bin.000990' at 661485030, the last event read from './mysql-bin.000990' at 661485030, the last byte read from './mysql-bin.000990' at 120.'
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
......

// 开启slave时报error 1236,处理方法:

# on Master:

mysql> show variables like 'binlog_checksum%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| binlog_checksum | CRC32 |
+-----------------+-------+
1 row in set (0.00 sec)

mysql> set global binlog_checksum='NONE';
Query OK, 0 rows affected (0.22 sec)

mysql> show variables like 'binlog_checksum%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| binlog_checksum | NONE  |
+-----------------+-------+
1 row in set (0.00 sec)

注:在修改"bingo_checksum"后,如果原先在slave上使用的是mysqldump导出的数据副本进行的数据导入,那么需要使用mysqldump(需要得到master log pos,在slave上导出时使用'--dump-slave=2')重新生成一份 "bingo_checksum"修改后的sql文件去slave上进行数据导入。

你可能感兴趣的:(处理slave(低版本)复制master(高版本)产生的error 1236)