Error 1594 en Mysql Slave

mysql_replication_topology_threads

El Error 1594 de mysql es debido a la corrupción del archivo de replicación. Normalmente ésto sucede despues de una caída total de server por algún problema de hardware.

Al reiniciar el servidor esclavo mysql, despues de una inesperada caída, fácilmente tendremos un error 1594.

Dentro de nuestro mysql esclavo podemos ejecutar:

mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 71.42.47.33
Master_User: slaveuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin-ie.000054
Read_Master_Log_Pos: 37557179
Relay_Log_File: mysql-relay-bin.000126
Relay_Log_Pos: 79228140
Relay_Master_Log_File: mysql-bin-ie.000044
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 (yo      u 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: 79227991
Relay_Log_Space: 800646320
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 (yo      u 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: 1 1 row in set (0.00 sec)

Tomaremos nota de los valores:

Relay_Master_Log_File: mysql-bin-ie.000044
Exec_Master_Log_Pos: 79227991

Para solucionar éste error, tenemos que parar el esclavo y resetearlo. Luego coger de nuevo el archivo de logs y resincronizar el mysql esclavo con el maestro:

mysql> stop slave;
Query OK, 0 rows affected (0.13 sec)

mysql> reset slave all;
Query OK, 0 rows affected (0.14 sec)

mysql>  CHANGE MASTER TO MASTER_HOST=’ip_maestro’, MASTER_USER=’usuario_master’, MASTER_PASSWORD=’master_password’, MASTER_LOG_FILE=’mysql-bin-ie.000044′, MASTER_LOG_POS=79227991;
Query OK, 0 rows affected (0.11 sec)

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

Una vez que el esclavo empieza a funcionar, veremos que empieza a sincronizar sin errores y el tiempo entre el master y el slave irá decreciendo hasta llegar a cero

mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 71.42.47.33
Master_User: slaveuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin-ie.000056
Read_Master_Log_Pos: 19204394
Relay_Log_File: mysql-relay-bin.000033
Relay_Log_Pos: 19204543
Relay_Master_Log_File: mysql-bin-ie.000056
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 19204394
Relay_Log_Space: 19204745
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)

mysql>

Si todo ha ido correctamente en poco tiempo volveremos a tener:

Seconds_Behind_Master: 0

Que es el tiempo de delay entre el master y nuestro esclavo.

 

Esta web utiliza cookies propias para su correcto funcionamiento. Al hacer clic en el botón Aceptar, aceptas el uso de estas tecnologías y el procesamiento de tus datos para estos propósitos. Más información
Privacidad
Abrir chat
¿Podemos ayudarte?