溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

怎么解決MySQL中the master's binary log is corrupted報(bào)錯(cuò)問題

發(fā)布時(shí)間:2021-11-18 16:24:32 來源:億速云 閱讀:252 作者:iii 欄目:MySQL數(shù)據(jù)庫

本篇內(nèi)容介紹了“怎么解決MySQL中the master's binary log is corrupted報(bào)錯(cuò)問題”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

主從復(fù)制報(bào)錯(cuò),下面是從庫復(fù)制狀態(tài):

mysql> show slave status\G;

*************************** 1. row ***************************

               Slave_IO_State: Waiting for master to send event

                  Master_Host: 192.168.129.150

                  Master_User: replicat

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: mysql-bin.000197

          Read_Master_Log_Pos: 213271941

               Relay_Log_File: mysql-relay-bin.000584

                Relay_Log_Pos: 1037392990

        Relay_Master_Log_File: mysql-bin.000195

             Slave_IO_Running: Yes

            Slave_SQL_Running: No

...

                   Last_Errno: 1594

                   Last_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.

                 Skip_Counter: 0

          Exec_Master_Log_Pos: 1037392827

              Relay_Log_Space: 2368588837

...

               Last_SQL_Errno: 1594

               Last_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.

  Replicate_Ignore_Server_Ids:

             Master_Server_Id: 3

                  Master_UUID: 58c0c354-8652-11e6-bebe-40f2e9ddc532

             Master_Info_File: /data/DB/mysql/master.info

                    SQL_Delay: 0

          SQL_Remaining_Delay: NULL

      Slave_SQL_Running_State:

           Master_Retry_Count: 86400

                  Master_Bind:

      Last_IO_Error_Timestamp:

     Last_SQL_Error_Timestamp: 161018 09:38:49

....

中繼日志讀主庫日志失敗 ,順道看下錯(cuò)誤日志信息,日志顯示從庫9點(diǎn)37分時(shí)重啟了,38分出現(xiàn)主從故障,看樣子是因?yàn)閺膸飚惓V貑?dǎo)致的!

161018 09:37:39 mysqld_safe Number of processes running now: 0

161018 09:37:39 mysqld_safe mysqld restarted

...

2016-10-18 09:38:49 6042 [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

解決方法,重新設(shè)置主從進(jìn)程解決:

mysql> stop slave;

Query OK, 0 rows affected (0.02 sec)

mysql> reset slave;

Query OK, 0 rows affected (0.57 sec)

mysql> change master to master_host='192.168.129.150',

    -> master_user='replicat',

    -> master_password='passw',

    -> master_log_file='mysql-bin.000195',

    -> master_log_pos=1037392827;

Query OK, 0 rows affected, 2 warnings (0.07 sec)

mysql> start slave;

Query OK, 0 rows affected (0.03 sec)

以前從庫異常重啟都沒發(fā)生這類情況,網(wǎng)上查了相關(guān)資料,發(fā)現(xiàn)和relay_log_info_repository和relay_log_info_repository這兩個(gè)參數(shù)有關(guān)

mysql> show variables like '%relay_log_info_repository%';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| relay_log_info_repository | FILE  |
+---------------------------+-------+

1 row in set (0.00 sec)

mysql> show variables like '%relay_log_info_repository%';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| relay_log_info_repository | FILE  |
+---------------------------+-------+

1 row in set (0.00 sec)

把FILE修改成TABLE可以降低這種主從失敗發(fā)生的概率。

“怎么解決MySQL中the master's binary log is corrupted報(bào)錯(cuò)問題”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI