Mysql – replication error

MySQLreplication

I am getting error for connect to master (mysql 5.1) from slave (mysql5.7)

Slave I/O for channel '': error connecting to master
'replica@hostname' – retry-time: 60 retries: 6, Error_code: 2027

Please help to solve this errror

Best Answer

Explain the code (sort of)

From the B.4 Client Error Codes and Messages page of the "MySQL 5.7 manual", the error code 2027 means:

Error: 2027 (CR_MALFORMED_PACKET)

Message: Malformed packet

That's not very informative. Looking for this error code, I've found this bug, fixed on MySQL 5.7.8:

For small values of the read_rnd_buffer_size system variable, internal caching of temporary results could fail and cause query execution failure.

You may check the value that you have for read_rnd_buffer_size variable if you have mysql 5.7.7 or lower in a hope to fix your issue, but it might not work.

The replication incompatibility

So, what is your problem. The problem is that you can't have a replication between versions 5.1 and 5.7. From the manual page Replication Compatibility Between MySQL Versions:

MySQL supports replication from one release series to the next higher release series. For example, you can replicate from a master running MySQL 5.5 to a slave running MySQL 5.6, from a master running MySQL 5.6 to a slave running MySQL 5.7, and so on.

Check that page for more information (there are incompatibilities on having many different minor versions, for setups with 3 or more servers).

I haven't really confirmed this by configuring a similar setup, but it seems that you need to upgrade your Mysql 5.1 to at least 5.6 (but preferably to 5.7). If your new 5.7 slave is fresh, you might try to downgrade it from mysql 5.7 to 5.5 (reinstalling and importing fresh data).

But the upgrade from 5.1 to 5.7 option is preferable, as you will have better and improved mysql installations.