{"id":12620,"date":"2024-07-01T13:33:58","date_gmt":"2024-07-01T08:03:58","guid":{"rendered":"https:\/\/www.skynats.com\/?p=12620"},"modified":"2025-01-08T20:35:53","modified_gmt":"2025-01-08T15:05:53","slug":"how-to-fix-mysql-replication-error-1594-relay-log-read-failure","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-fix-mysql-replication-error-1594-relay-log-read-failure\/","title":{"rendered":"How to Fix MySQL Replication Error 1594: &#8220;Relay Log Read Failure&#8221;"},"content":{"rendered":"\n<figure class=\"wp-block-image size-medium is-resized is-style-default\"><img fetchpriority=\"high\" decoding=\"async\" width=\"300\" height=\"300\" sizes=\"(max-width: 300px) 100vw, 300px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/07\/MySqL-300x300.png\" alt=\"MySQL Replication Error 1594:\" class=\"wp-image-12622\" style=\"aspect-ratio:1.7777777777777777;object-fit:cover;width:207px;height:auto\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/07\/MySqL-300x300.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/07\/MySqL-150x150.png 150w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/07\/MySqL-768x768.png 768w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/07\/MySqL.png 810w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Occasionally, MySQL replication fails because of corrupted relay binlogs, and just running the &#8216;start slave&#8217; command will not solve the issue. Here&#8217;s a step-by-step method for resolving this issue.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.skynats.com\/server-management\/\">MySQL replication<\/a> on the slave has stopped. When checked the slave status, it showed Yes for Slave_IO_Running but No for Slave_SQL_Running.\u00a0 It seems that the current slave&#8217;s relay log was corrupted.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Following is the full output from the display slave status command on a slave server.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> SHOW SLAVE STATUS\\G\n***********************1. row ***********************\nSlave_IO_State: Waiting for master to send event\nMaster_Host: *.*.*.*\nMaster_User: replicant\nMaster_Port: 3306\nConnect_Retry: 60\nMaster_Log_File: mysql-bin.013184\nRead_Master_Log_Pos: 319962954\nRelay_Log_File: db1-relay-bin.007401\nRelay_Log_Pos: 992575394\nRelay_Master_Log_File: mysql-bin.012684\nSlave_IO_Running: Yes\nSlave_SQL_Running: No\nReplicate_Do_DB:\nReplicate_Ignore_DB:\nReplicate_Do_Table:\nReplicate_Ignore_Table:\nReplicate_Wild_Do_Table:\nReplicate_Wild_Ignore_Table:\nLast_Errno: 1594\nLast_Error: 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.\nSkip_Counter: 0\nExec_Master_Log_Pos: 992575181\nRelay_Log_Space: 537058497755\nUntil_Condition: None\nUntil_Log_File:\nUntil_Log_Pos: 0\nMaster_SSL_Allowed: No\nMaster_SSL_CA_File:\nMaster_SSL_CA_Path:\nMaster_SSL_Cert:\nMaster_SSL_Cipher:\nMaster_SSL_Key:\nSeconds_Behind_Master: NULL\nMaster_SSL_Verify_Server_Cert: No\nLast_IO_Errno: 0\nLast_IO_Error:\nLast_SQL_Errno: 1594\nLast_SQL_Error: 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.\nReplicate_Ignore_Server_Ids:\nMaster_Server_Id: 2\nMaster_Info_File: \/var\/lib\/mysql\/master.info\nSQL_Delay: 0\nSQL_Remaining_Delay: NULL\nSlave_SQL_Running_State:\nMaster_Retry_Count: 86400\nMaster_Bind:\nLast_IO_Error_Timestamp:\nLast_SQL_Error_Timestamp: 240627 13:09:22\nMaster_SSL_Crl:\nMaster_SSL_Crlpath:\nRetrieved_Gtid_Set:\nExecuted_Gtid_Set:\nAuto_Position: 0\nReplicate_Rewrite_DB:\nChannel_Name:\nMaster_TLS_Version:\n1 row in set (0.00 sec)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To resolve this error, erase the current binlog files on the slave and set a new position. Before proceeding, keep a note of the values for Relay_Master_Log_File and Exec_Master_Log_Pos.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Relay_Master_Log_File: mysql-bin.012684\nExec_Master_Log_Pos: 992575181<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To relaunch replication, use the following commands.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. First stop the slave using<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> stop slave;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Then reset the slave&#8217;s replication position in the master binary log.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> reset slave;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Configure the slave to resume reading from its previous stop position.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> change master to master_log_file='mysql-bin.012684', master_log_pos=992575181;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the values noted before.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. Finally start the slave<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> start slave;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After following the above commands, check the slave status using the command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql> SHOW SLAVE STATUS\\G<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When the Seconds_Behind_Master value equals 0, the Master and Slave servers will be synced. Note that &#8220;reset slave&#8221; will erase master.info, relay-log.info, and all relay log files, reducing the need to manually clean up the \/var\/lib\/mysql directory<a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noopener\">.<\/a> Once all commands have been executed, the slave will reconnect with the master and start to read SQL statements.\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re facing the MySQL replication error 1594: &#8220;Relay Log Read Failure,&#8221;. Our team of experts can provide comprehensive support and swift solutions to resolve this issue and ensure your database runs smoothly. Contact <a href=\"https:\/\/www.skynats.com\/blog\/\">Skynats<\/a> for professional assistance and minimize downtime with our reliable support services.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally, MySQL replication fails because of corrupted relay binlogs, and just running the &#8216;start slave&#8217; command will not solve the issue. Here&#8217;s a step-by-step method for resolving this issue. MySQL replication on the slave has stopped. When checked the slave status, it showed Yes for Slave_IO_Running but No for Slave_SQL_Running.\u00a0 It seems that the current [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257,5],"tags":[881,882,105],"class_list":["post-12620","post","type-post","status-publish","format-standard","hentry","category-mysql","category-blog","tag-data-replication","tag-mysql-troubleshooting","tag-server-administration"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=12620"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12620\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=12620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=12620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=12620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}