MySql Replication Errors

Replication errors :

*******************************************************************************************************************************

1.  “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”

  1. Login to slave server [Server which is lagging] and access MySQL prompt
  2. Stop the slave using the following command:
  • STOP SLAVE;
  1. Check the current status of slave:
  • SHOW SLAVE STATUS\G;
  1. Note  down the values of Relay_Master_Log_File and Exec_Master_Log_Pos
  2. 5.       change master to MASTER_LOG_FILE=’xxxx’,MASTER_LOG_POS=yyyy;  xxxx being the value Relay_Master_Log_File and yyyy being the value of Exec_Master_Log_Pos using the following command:

 

  • CHANGE MASTER TO MASTER_LOG_FILE=”xxxx”, MASTER_LOG_POS=yyyy;
  1. Start the slave using the following command:
  • START SLAVE;

Once you have done this, just check the slave status again to confirm that the “MASTER_LOG_FILE” and “MASTER_LOG_POS” has been changed successfully. There will be a slight lag after this and this lag will be fine after few minutes.

********************************************************************************************************************************

2. “Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Client requested master to start replication from impossible position’”

  1. Login to slave server [Server which is lagging] and access MySQL prompt
  2. Stop the slave using the following command:

 

  • STOP SLAVE;

 

  1. Check the current status of slave:

 

  • SHOW SLAVE STATUS\G;

 

  1. Check the value of MASTER_LOG_FILE and let it be mysql-bin.000743 (for example)
  2. Change the slave to read from next bin file

 

  •  CHANGE MASTER TO MASTER_LOG_FILE = ‘mysql-bin.000744’, MASTER_LOG_POS = 4;

 

  1. Start the slave using the following command:

 

  • START SLAVE;

*******************************************************************************************************************************

3. “Last_SQL_Error: Error ‘Incorrect key file for table ‘./database_name/table_name.MYI’; try to repair it’ on query. Default database: ‘database_name’”

Commands to fix:

mysql> use database_name

mysql> repair table table_name;

mysql> slave stop;

mysql> slave start;

*******************************************************************************************************************************

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s