This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
build:backups [2007/06/13 14:35] 206.197.251.70 Add sections for tarball backups and rsync backups. (CMB) |
build:backups [2007/10/15 14:04] 4.245.73.220 |
||
---|---|---|---|
Line 4: | Line 4: | ||
We're also backing up locally to tarballs for easier access, and to have multiple versions of backups. | We're also backing up locally to tarballs for easier access, and to have multiple versions of backups. | ||
+ | |||
===== Backup Dirs ===== | ===== Backup Dirs ===== | ||
Line 10: | Line 11: | ||
<code rootshell> | <code rootshell> | ||
mkdir -p /var/backups | mkdir -p /var/backups | ||
+ | mkdir -p /var/backups/bud | ||
+ | mkdir -p /var/backups/budlight | ||
mkdir -p /var/backups/etc | mkdir -p /var/backups/etc | ||
mkdir -p /var/backups/home | mkdir -p /var/backups/home | ||
mkdir -p /var/backups/usr_local | mkdir -p /var/backups/usr_local | ||
mkdir -p /var/backups/email | mkdir -p /var/backups/email | ||
+ | mkdir -p /var/backups/web | ||
+ | mkdir -p /var/backups/mysql | ||
chmod -R 600 /var/backups | chmod -R 600 /var/backups | ||
</code> | </code> | ||
Line 19: | Line 24: | ||
===== Rsync Backups ===== | ===== Rsync Backups ===== | ||
+ | |||
+ | For the procedure used for backups of michelob and dark using rsync, see [[rsync-aix]]. | ||
===== Tarball Backups ===== | ===== Tarball Backups ===== | ||
Line 88: | Line 95: | ||
==== Backup of Web Sites ==== | ==== Backup of Web Sites ==== | ||
NOTE: We currently store web sites in ''/home/web'', so we do not need to back up anything separately at this point. | NOTE: We currently store web sites in ''/home/web'', so we do not need to back up anything separately at this point. | ||
+ | |||
==== Backup of Email ==== | ==== Backup of Email ==== | ||
NOTE: We currently store users' email folders in their home directories, so we do not need to back up anything separately at this point. | NOTE: We currently store users' email folders in their home directories, so we do not need to back up anything separately at this point. | ||
+ | ==== Backup File Rotation ==== | ||
+ | TODO: We need to delete tarballs that get old, so we don't keep too many around. Would be nice to keep: 1 backup per day for 1 week (or 2 weeks); 1 backup per week for a year (or 1-6 months); 1 backup per month forever. | ||
+ | |||
+ | ===== MySQL ===== | ||
+ | |||
+ | Decided not to use ''mysqlhotcopy'', as it does not handle InnoDB databases, which some of our apps may require. So we're using ''mysqldump''. The ''--add-locks'' makes loading the resulting dump faster. The ''--allow-keywords'' allows fields to have the same name as SQL keywords. The ''--create-options'' includes MySQL-specific options on ''CREATE TABLE'' statements. | ||
+ | |||
+ | <code rootshell> | ||
+ | #!/bin/sh | ||
+ | BACKUPDIR=/var/backups/mysql | ||
+ | DATE=`date +'%Y%m%d'` | ||
+ | mysqldump --all-databases --add-locks --allow-keywords --create-options > $BACKUPDIR/mysql-$DATE.sql | ||
+ | gzip $BACKUPDIR/mysql-$DATE.sql | ||
+ | </code> | ||
+ | |||
+ | TODO: Add this to cron. | ||
===== TODO ===== | ===== TODO ===== | ||
Line 104: | Line 128: | ||
Back up email folders separately, if/when they're no longer held in home directories. | Back up email folders separately, if/when they're no longer held in home directories. | ||
+ | Take a look at [[http://jeremy.zawodny.com/mysql/ | mysqlsnapshot]] to see if it might work better for MySQL backups. Note that it has not been updated for MySQL 4.x or 5.x, but it's a Perl script, so it might still work. |