Solved

MySQL slave table crashed, how to fix it?

Posted on 2012-12-31
3
468 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

707 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