Sometimes if a database gets corrupted, a replicated database could also replicate that same corruption.
What is the best way to replicate/backup a database and prevent something like this from happening?
(specifically for MySQL)
Sometimes if a database gets corrupted, a replicated database could also replicate that same corruption.
What is the best way to replicate/backup a database and prevent something like this from happening?
(specifically for MySQL)
If the "corruption" is at a level where it will be replicated, then the only solution is frequent backups and a good means of detecting such corruption so you can quickly recover. You'd need to define how to detect the corruption based on your specific application, because from the database's point of view, everything is as it should be.
This covers everything you want in depth: http://dev.mysql.com/doc/refman/5.1/en/backup-methods.html
Basically, what you probably want is a slave that you can do daily and/or weekly full backups on, then do incremental backups by saving the binary logs since the full backup. You can re-play the binary logs to any command you want.
and to add more information about what opsguy said, there is a few scripts known as to replay binary logs and so, you can check maatkit documentation: http://www.maatkit.org/