Search code examples
phpmysqlbackuplampbackup-strategies

(Lightweight) backup strategies for a LAMP application stack?


I'm researching some lightweight tools to backup a LAMP stack. The two most imporatant pieces are the

  • php codebase and
  • the mysql database.

I can tar/bz2 the code and a mysqldump and restore it on a new server (if the old one crashes) and this is more or less fine.

Anyway, are there more complete solutions to this?

  • e.g. track and re-install additionally installed pear-packages;
  • track other packages related to the LAMP stack installed via linux package managers, e.g. APC;
  • keep mysql and php configurations alongside backups and being able to restore them automatically ...
  • possibly complete server images, which can be restored without the need to reinstall everything ..

I'm curious about hints, tips, experiences, solutions ..


Solution

  • The PHP code base should be managed in a version control system such as SVN, Git, etc. Just creating a tar doesn't give you many capabilities that a proper version control system gives you.

    The trouble with mysqldump is that you have to lock the tables you are dumping to ensure a consistent snapshot. If this takes a long time, other DB operations might timeout while waiting. We use a wonderful script for snapshotting the running database without excessive locks. It was designed for the Amazon/EC2 environment but the principals apply to any Linux system with the xfs file system.