I have a mirrored RAID 1 server. This server has mysql databases. If I run a query to update a mysql database, does this update also get updated on a RAID 1 mirrored setup or do I need a different way to backup mysql data?
-
1Just bear in mind that raid is not any form of Backup. Depending on the level of raid, it is protection from the failure of a disk drive but will not offer you any data protection if your database gets corrupted, wiped, deleted by accident, (or on purpose), the server getting blown up, burnt, electrically fried or nicked – Anigel Feb 17 '14 at 10:26
-
Thanks Anigel. I was really just checking that any updates done to a mysql database instantly get updated to disk 2... which by the sounds of things it does. – jon Feb 17 '14 at 10:33
1 Answers
It depends on what you're doing the backups for. I split backups into those that are for "disaster recovery" and those that are for what I call "moron recovery"; the former are to protect against equipment failure, the latter are to protect against human error (please don't rail about the choice of words; I'm the moron in question, as often as not).
They aren't the same purpose, and they therefore require different kinds of backups. RAID-1 protects well against the former; if one of the HDDs fail, you'll still have a working OS and db, and (given hot-swap RAID) you'll be able to replace the failed drive and restore redundancy with nary a hiccup. But if someone accidentally deletes all the db files on one drive, the mirroring logic will instantly delete all the db files on the other drive.
So to my mind: RAID-1 protects well for disaster recovery, but does nothing for moron recovery. You haven't said what you want, so we can't say if it'll work for you.
Edit following your comment below: assuming the datafiles are in a part of the file system that's on the RAID-1 pair, yes, that is correct. But if you're going to rely on this for production, you will need to know what failure looks like, and how to recover: doing both those will give you the opportunity to verify that the DB can run with one disc down, anyway, so don't forget to develop, document, and practise your recovery procedures before you put this into production.
- 78,442
- 20
- 178
- 229
-
Thanks Madhatter, just to confirm: Any updates to a mysql database instantly get duplicated, so in the event that one disk fails I have note lost the mysql data? – jon Feb 17 '14 at 10:25
-
Hey MadHatter.. I didn't fully understand your edit... So if mysql is installed on disk 1, any updates made to a database on disk 1 would also get duplicated on disk 2? – jon Feb 17 '14 at 11:02
-
@jon I'm not madhatter but _yes_. You might find this (http://serverfault.com/questions/339128/what-are-the-different-widely-used-raid-levels-and-when-should-i-consider-them) answer about how RAID works useful if you want to understand what's going better. – Rob Moir Feb 17 '14 at 11:24
-
You're using "*installed*" rather ambiguously, there. `mysql` is usually installed in `/usr/bin`, etc. - that's where the binaries are. But protection for the db files depends on mirroring where those files are, and that's distro- and config-dependent. In my experience it's often `/var/lib/mysql`, but you will need to have confidence about where yours are before concluding that you have proper protection. – MadHatter Feb 17 '14 at 11:26