Solved

MySQL slave table crashed, how to fix it?

Posted on 2012-12-31
3
453 Views
Last Modified: 2013-12-31
I have a corrupt MySQL slave table, it says:
table is marked as crashed and last repair failed

Of course, when i ran repair statement, it still showed: Corrupt

My purpose is to quickly restore the slave table. Since master table is good, my question is can i use one of the two options listed below:
1. Drop slave table, stop and start slave again, will replication automatically restore the slave table? (previously the replication was working fine)
2. Drop slave table, use mysqldump to dump the master table to slave table (suppose there is not much traffic at this time).

Thanks for any suggestion.
0
Comment
Question by:heyday2004
  • 2
3 Comments
 
LVL 24

Assisted Solution

by:johanntagle
johanntagle earned 500 total points
ID: 38734005
Replication won't automatically restore the slave table.  I also suggest against your second option because the table on the master is already ahead of the slave - you are still going to encounter replication errors or data inconsistency between master and slave because it replication will attempt to apply updates that are already there since you used a dump from the master.  I think your options are:

1.  If the table is innodb, try out the tool described here: http://www.percona.com/software/mysql-innodb-data-recovery-tools.  If all goes well you should be able to resume replication from where you left off

2.  Fully (not just the corrupted table) restore your slave  from a backup.  Hopefully your backup also contains the replication info so that is will resume from there.

3.  Fully recreate your slave from your master.  I recommend Percona Xtrabackup (http://www.percona.com/software/percona-xtrabackup) so you can do your backup from the master without downtime, though you should still do it on an off-peak hour.
0
 

Author Comment

by:heyday2004
ID: 38735409
This is extremely helpful. Many thanks.

If the table is MyISAM, what is the standard way to fully recreate the slave from the master without using Percona tools? Thanks!
0
 
LVL 24

Accepted Solution

by:
johanntagle earned 500 total points
ID: 38735418
Sorry, don't know of any.

By the way, since the table is MyISAM even the percona xtrabackup tool will require a downtime since it will need to lock the table.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question