Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If the server fries and all you have is your last backup, you at least want it to be congruent in itself / of high integrity. Well, I do.

What I am worried about is that without downtime, one faces a race between the database dump und the copying of static files:

No matter which one you start first or whether you start them both at once, one will finish before the other, allowing itself to be updated by users interacting with the website (e.g., uploading files and/or causing the database content to change).

Sorry if this is a dupe, I haven't found a question that already addresses exactly this.

Do you inspect the db dump and check for mismatches in the list of recorded file names/paths vs. the list of actual files in the static content backup?
I am assuming that the timestamps at filesystem level do not necessarily match those in the database, so comparing last timestamps will not be reliable.

Or are inconsistencies so rare in practice that you just don't care, because a fried server would be a much bigger problem for you to begin with?

If it helps, the relevant services we are using are Apache2, MySQL5.

Thanks!

share|improve this question

3 Answers 3

No, you put your site into "maintenance mode" (which usually manifests itself as either a "we're doing maintenance" page or alternatively running 100% read-only) until you've recovered things into a stable/consistent state. If doing the above is not an option, you probably should ask yourself whether relying on a single server is a good idea.

share|improve this answer
    
For hourly automated backups, no, this should not be an option. I am aware that I could take my time dumping the db content if I do it on a read slave - but how do sync that with the backing up of static stuff? Even if I have a seperate mirroring media server, I only see the problem being deferred. –  Geradeausanwalt Jul 30 '10 at 15:36
    
Sorry, I misread your question - thought it was more about restores than backups. –  EEAA Jul 30 '10 at 17:35

If you are using Linux, maybe you could use LVM snapshots to prevent modifications on the static files.

share|improve this answer
    
Sorry, didn't think to mention I'm one of those that still don't want to use LVM - so, it's not installed. –  Geradeausanwalt Jul 30 '10 at 18:51

I'd do it this way:

  • start database backup and record the timestamp
  • while it runs, store modified static content in alternate location (and continue to serve it)
  • start static content backup
  • when both backups finish, 'commit' new static content.

This way you can restore to a point in time.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.