Solved

MySQL slave table crashed, how to fix it?

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
A short film showing how OnPage and Connectwise integration works.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

16 Experts available now in Live!

Get 1:1 Help Now