# PXC replication from 5.7 master to 5.5 slave

**URL:** <https://forums.percona.com/t/pxc-replication-from-5-7-master-to-5-5-slave/5213>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [November 16, 2016, 6:32am UTC](https://forums.percona.com/t/pxc-replication-from-5-7-master-to-5-5-slave/5213 "2016-11-16T06:32:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![selivan](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@selivan](https://forums.percona.com/u/selivan)\
**Post date:** [November 16, 2016, 6:32am UTC](https://forums.percona.com/t/pxc-replication-from-5-7-master-to-5-5-slave/5213/1 "2016-11-16T06:32:10Z")

</div>

Currently I am running Percona XtraDB Cluster 5.5. To switch smoothly to 5.7, I need to set up two-directions replication between one of cluster nodes and standalone PXC 5.7 node. So that I can switch production to 5.7 and switch back if some problems occur.

Config file for 5.5:

​​​​​​​  
log\_slave\_updates = TRUE  
server-id = XXXX  
wsrep\_auto\_increment\_control = off  
auto-increment-offset = 1  
auto-increment-increment = 10

Config file for 5.7:

binlog\_checksum=NONE  
gtid\_mode=0  
log\_slave\_updates = FALSE  
server-id = YYYY  
wsrep\_auto\_increment\_control = off  
auto-increment-offset = 3  
auto-increment-increment = 10

Replication from 5.5(master) to 5.7(slave) works just fine.

Replication from 5.7(master) to 5.5(slave) produces an error

161116 14:09:27 [Note] WSREP: ready state reached  
161116 14:09:27 [Note] Slave SQL thread initialized, starting replication in log ‘mysql-bin.000082’ at position 150, relay log ‘./host55-relay-bin.000001’ position: 4  
161116 14:09:27 [ERROR] Error in Log\_event::read\_log\_event(): ‘Sanity check failed’, data\_len: 27, event\_type: 35  
161116 14:09:27 [ERROR] Error reading relay log event: slave SQL thread aborted because of I/O error  
161116 14:09:27 [ERROR] Slave SQL: 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. Error\_code: 1594  
161116 14:09:27 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with “SLAVE START”. We stopped at log ‘mysql-bin.000083’ position 123

Output from mysqlbinlog host55-relay-bin.000004:

/_!50530 SET @@SESSION.PSEUDO\_SLAVE\_MODE=1_/;  
/_!40019 SET @@session.max\_insert\_delayed\_threads=0_/;  
/_!50003 SET @OLD\_COMPLETION\_TYPE=@@COMPLETION\_TYPE,COMPLETION\_TYPE=0_/;  
DELIMITER /_!_/;

# at 4

#161116 14:05:43 server id 4310 end\_log\_pos 107 Start: binlog v 4, server v 5.5.41-37.0-55-log created 161116 14:05:43  
BINLOG ’  
hz0sWA/WEAAAZwAAAGsAAAAAAAQANS41LjQxLTM3LjAtNTUtbG9nAAAAAAAAAAAAAAAAAAAAAAAA  
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==  
'/_!_/;

# at 107

#700101 3:00:00 server id 4313 end\_log\_pos 0 Rotate to mysql-bin.000083 pos: 4

# at 150

#161116 14:06:43 server id 4313 end\_log\_pos 123 Start: binlog v 4, server v 5.7.14-8-57-log created 161116 14:06:43 at startup  
ROLLBACK/_!_/;  
BINLOG ’  
wz0sWA/ZEAAAdwAAAHsAAAAAAAQANS43LjE0LTgtNTctbG9nAAAAAAAAAAAAAAAAAAAAAAAAAAAA  
AAAAAAAAAAAAAAAAAADDPSxYEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA  
AFDxxKk=  
'/_!_/;  
ERROR: Error in Log\_event::read\_log\_event(): ‘Sanity check failed’, data\_len: 27, event\_type: 35  
ERROR: Could not read entry at offset 269: Error in log format or read error.  
DELIMITER ;

# End of log file

ROLLBACK /\* added by mysqlbinlog _/;  
/_!50003 SET COMPLETION\_TYPE=@OLD\_COMPLETION\_TYPE\*/;  
/_!50530 SET @@SESSION.PSEUDO\_SLAVE\_MODE=0_/;

How can I fix this to make replication work in both directions? Thanks

---

<div class="post-metadata">

**Author:** ![przemek](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/przemek/32/3_2.png) [@przemek](https://forums.percona.com/u/przemek)\
**Post date:** [November 17, 2016, 3:17am UTC](https://forums.percona.com/t/pxc-replication-from-5-7-master-to-5-5-slave/5213/2 "2016-11-17T03:17:51Z")

</div>

Replication from newer major version to older was never a supported way in MySQL. So you may expect problems when trying to replicate from 5.7 to 5.6 and even more problems trying to replicate from 5.5 to 5.7. See the official documentation here:  
[url][http://dev.mysql.com/doc/refman/5.7/en/replication-upgrade.html[/url]](http://dev.mysql.com/doc/refman/5.7/en/replication-upgrade.html%5B/url%5D)

There are many incompatible changes introduced in 5.7: [url][http://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-series.html[/url]](http://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-series.html%5B/url%5D)

First thing on which 5.5 slave will fail is the new binary log format, that is not recognizable by MySQL versions older then 5.6, as stated here:  
[url][MySQL :: MySQL 5.7 Reference Manual :: 16.1.6.4 Binary Logging Options and Variables](http://dev.mysql.com/doc/refman/5.7/en/replication-options-binary-log.html#option_mysqld_log-bin-use-v1-row-events%5B/url%5D)  
So you may try to set this to force older format, but still you may encounter many more potential issues.

I think there are better chances to have replication working between one major version, so you may try to add intermediate 5.6 instance, and try to get replication working like that: 5.7-\>5.6-\>5.5  
But again, this is only on your own risk, as this is not guaranteed to work, nor a safe solution.
