Solved

MySQL slave table crashed, how to fix it?

Posted on 2012-12-31
3
440 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now