?
Solved

MySQL slave table crashed, how to fix it?

Posted on 2012-12-31
3
Medium Priority
?
474 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 2000 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 2000 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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