Mysql – Backing up MySQL w/MyISAM on Amazon RDS

backupmyisamMySQLreplication

So, for various good reasons, we're maintaining a mySQL database using a MyISAM engine on Amazon RDS. I've just taken over this application, and I'm concerned we're not getting good backups, since snapshots aren't reliable.

I've had an idea. I propose to

  • periodically create a read replica
  • elevate it to be a separate instance
  • and do a mysqldump from that replica.

Does this make sense?

Best Answer

MyISAM tables are not guaranteed to be consistent with disk and, effectively, Amazon recommends to manually do the equivalent to a FLUSH TABLES WITH READ LOCK (you cannot do that in RDS, so you have to lock and flush each MyISAM table individually). So you are right in the fact that backups may not be doing correctly on your setup.

Creating a backup from a slave is a very common way of doing backups, because in your case, you do not care about blocking or affecting the performance of the slaves. But you are not really solving the problem, because MyISAM is not supported for read replicas, as it basically uses the same snapshoting mechanism, potentially inconsistent with non transactional databases.

If you really need hot & consistent backups, you need InnoDB. Otherwise, lock, flush & snapshot.

If you want to guarantee the consistency of a backup, though, setting a replica and seeing that it works is one of the typical easy ways to partially do it. So creating a replica and leaving it on for a while without replication breaking may mean that at least it has all the records and tables you used in your latest transactions (with no guarantee overall).