MySQL Replication Error 1594

Привет,

Днес ми се наложи да оправям проблем в репликацията на 3 master-master-slave сървъра, като грешката беше непозната за мен – а именно 1594.

MySQL Replication Error 1594

Проблемът:

MySQL Replication Error 1594

На единия master сървър след show slave status \G; излизаше следното:


*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: master-2-host
Master_User: replicator
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mariadb-bin.000300
Read_Master_Log_Pos: 10324307
Relay_Log_File: mysqld-relay-bin.000045
Relay_Log_Pos: 3162113
Relay_Master_Log_File: mariadb-bin.000300
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
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: 3161824
Relay_Log_Space: 10330113
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
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: 2
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
1 row in set (0.00 sec)

Обичайното решение на проблема:


STOP SLAVE;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;

не помогнаха, и затова се наложи да потърся в интернет решение на проблема.

Решението:

В крайна сметка проблема го реших по следният начин:

От master-2-host копирах следната информация:

MariaDB [(none)]> show master status;
+--------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------------+----------+--------------+------------------+
| mariadb-bin.000300| 10523723| | |
+--------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

 

След това в първият master сървър направих следното :


MariaDB [(none)]> stop slave;
MariaDB [(none)]> reset slave;
MariaDB [(none)]> change master to master_log_file='mariadb-bin.000300', master_log_pos=10523723;
MariaDB [(none)]> start slave;

Тук важното беше да използвам master_log_file и master_log_post от другият master сървър.

След тази процедура репликацията отново тръгна и всичко беше наред! 🙂

Общо взето това е!