backup
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| backup [2010/10/16 00:01] – created aorth | backup [2019/05/08 09:35] (current) – removed aorth | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Backups ====== | ||
| - | We utilize three methods for backups: | ||
| - | * [[backup: | ||
| - | * [[backup: | ||
| - | * [[backup: | ||
| - | ====== Tape backup ====== | ||
| - | |||
| - | Tape backups are run manually __once per week__, __on Friday afternoon__. | ||
| - | |||
| - | A full system backup includes: | ||
| - | |||
| - | * ''/'' | ||
| - | * ''/ | ||
| - | * ''/ | ||
| - | * ''/ | ||
| - | |||
| - | This takes about 30-35 hours depending on the load of the server and whether or not the robot is working properly. | ||
| - | ==== Problems ==== | ||
| - | * Sometimes tapes are hard to remove from the cassette (this causes the robot to jam sometimes) | ||
| - | * Even setting the virtual device to " | ||
| - | |||
| - | ==== Monitoring the backup ==== | ||
| - | |||
| - | The Storix Backup tool shows the current status of the backup but if you're not sitting at the machine there is no way to see. You can use a one-line shell script to loop periodically and check the status of the tape library. | ||
| - | < | ||
| - | ==== Backup history ==== | ||
| - | |||
| - | ^ Date ^ Tape set ^ Notes ^ | ||
| - | | Oct 30, 2009 | A | Robot jammed on tape 7, backup did not complete | ||
| - | | Nov 6, 2009 | B | Completed successfully | ||
| - | | Nov 13, 2009 | A | Completed successfully | ||
| - | | Nov 20, 2009 | B | Backup completed successfully, | ||
| - | | Nov 27, 2009 | A | Completed successfully | ||
| - | | Dec 4, 2009 | B | Backup completed successfully, | ||
| - | | Dec 11, 2009 | A | Backup failed to start (appears to be a software problem, server might need a reboot) | | ||
| - | | Dec 21, 2009 | A | Completed successfully | ||
| - | | Jan 8, 2010 | B | Completed successfully | ||
| - | | Jan 15, 2010 | A | Backup completed successfully, | ||
| - | | Jan 22, 2010 | B | Backup completed successfully, | ||
| - | | Jan 29, 2010 | A | Backup complete successfully, | ||
| - | | Feb 5, 2010 | B | Completed successfully | | ||
| - | | Feb 12, 2010 | A |Completed successfully | | ||
| - | | Feb 19, 2010 | B | Completed successfully | | ||
| - | | March 12, 2010 | A | Completed successfully | | ||
| - | | March 19, 2010 | B |Completed successfully | | ||
| - | | April 1, 2010 | A | Completed successfully | | ||
| - | | April 9, 2010 | B |Completed successfully | | ||
| - | | April 16, 2010 | A |Completed successfully | | ||
| - | | April 23, 2010 | A | Completed successfully | | ||
| - | | April 30, 2010 | B | Completed successfully | | ||
| - | | May 07, 2010 | A | Completed successfully | | ||
| - | | May 21, 2010 | B | completed successfully | | ||
| - | | June 4, 2010 | A | completed successfully | | ||
| - | | June 9, 2010 | B | completed successfully | | ||
| - | | June 18, 2010 | A | completed successfully | | ||
| - | | June 25, 2010 | B | Completed successfully | | ||
| - | | July 2, 2010 | A | Completed successfully | | ||
| - | | July 9, 2010 | B | Completed successfully | | ||
| - | | July 16, 2010 | A | Completed successfully | | ||
| - | | July 23, 2010 | B | Completed successfully | | ||
| - | | July 30, 2010 | A | Completed successfully | | ||
| - | | August 6, 2010 | B | Completed successfully | | ||
| - | | August 13, 2010 | A | ... | | ||
| - | | September 3, 2010 | A | Completed successfully, | ||
| - | | September 10, 2010 | B | Completed successfully, | ||
| - | | September 17, 2010 | A | HPC crashed during the previous night, backups couldn' | ||
| - | | September 24, 2010 | A | Completed successfully | | ||
| - | | October 1, 2010 | B | Completed successfully | | ||
| - | | October 8, 2010 | A | Completed successfully | | ||
| - | | October 15, 2010 | B | ... | | ||
| - | |||
| - | ===== Rsync ===== | ||
| - | Rsync is a tool for keeping a source and destination synchronized (on the same physical machine or over a network). | ||
| - | |||
| - | * BecA-ILRI wiki: http:// | ||
| - | * TParvaDB: http:// | ||
| - | ==== Configure HPC ==== | ||
| - | Create the backup directories: | ||
| - | < | ||
| - | |||
| - | ==== BecA-ILRI Wiki Backup ==== | ||
| - | Because the wiki does not use SQL we can back it up by simply copying its web-accessible data files. | ||
| - | |||
| - | === Set up SSH keys === | ||
| - | We will use password-less logins to HPC for the backup. | ||
| - | < | ||
| - | Paste the new public key inside root's '' | ||
| - | < | ||
| - | Now try to login to HPC as root: | ||
| - | < | ||
| - | If you were logged in successfully without typing a password you can now test the backup. | ||
| - | |||
| - | === Test the backup === | ||
| - | < | ||
| - | |||
| - | === Automate the backup === | ||
| - | If everything is working you can set the rsync job to run automatically with cron. Add the following entry to root's crontab: | ||
| - | < | ||
| - | 0 | ||
| - | This will run the backup job at 6:00 pm every day. | ||
| - | ==== TParvaDB ==== | ||
| - | We have to preserve system permissions, | ||
| - | |||
| - | === Set up SSH keys === | ||
| - | We will use password-less logins to HPC for the backup. | ||
| - | < | ||
| - | Paste the new public key inside root's '' | ||
| - | < | ||
| - | Now try to login to HPC as root: | ||
| - | < | ||
| - | If you were logged in successfully without typing a password you can now test the backup. | ||
| - | |||
| - | === Test the backup === | ||
| - | < | ||
| - | |||
| - | === Automate the backup === | ||
| - | If everything is working you can set the rsync job to run automatically with cron. Add the following entry to root's crontab: | ||
| - | < | ||
| - | 0 | ||
| - | This will run the backup job at 7:00 pm every day. | ||
| - | |||
| - | === To restore === | ||
| - | Make sure to stop the affected services first (Apache, PostgreSQL, MySQL). Use the same rsync command as above, but switch the order. | ||
| - | < | ||
| - | Then restart the services. | ||
| - | |||
| - | ==== Links ==== | ||
| - | * Backup a running system with rsync: http:// | ||
| - | |||
| - | ===== Storix Backup Administrator ===== | ||
| - | We are using an Exabyte Tape library for backups and the commercial Storix Backup Administrator software [[http:// | ||
| - | |||
| - | Version: | ||
| - | < | ||
| - | 6.3.4.4</ | ||
| - | |||
| - | Storix System Backup Administrator: | ||
| - | |||
| - | Graphicaluser interface: '' | ||
| - | |||
| - | The Exabyte device has one tape " | ||
| - | ==== Documentation ==== | ||
| - | |||
| - | * {{: | ||
| - | * {{: | ||
| - | * {{: | ||
| - | * {{: | ||
| - | * {{: | ||
| - | |||
| - | ==== Notes ==== | ||
| - | |||
| - | '' | ||
| - | |||
| - | Tape drive: /dev/st0 | ||
| - | Library: /dev/sg0 | ||
| - | |||
| - | Test: '' | ||
| - | BOT keyword means tape in drive | ||
| - | |||
| - | Rewind tape: '' | ||
| - | |||
| - | Make backup: | ||
| - | List files on tape: '' | ||
| - | Rewind and eject tape: '' | ||
| - | Restore tape (insert tape): '' | ||
| - | |||
| - | To make more than one backup to same tape: | ||
| - | Use ''/ | ||
| - | |||
| - | Tape library commands: | ||
| - | |||
| - | '' | ||
| - | |||
| - | '' | ||
| - | |||
| - | ==== Bootable USB recovery ==== | ||
| - | |||
| - | http:// | ||
| - | ===== Example Scripts ===== | ||
| - | Example scripts to be used on ILRI servers for automated backup and maintenance of data. Most should be configured to run via cron, usually as root. Make sure that any critical scripts are protected by changing the permissions to 700 so only root can read them. | ||
| - | |||
| - | To add a cron entry, edit root's cron tab: | ||
| - | < | ||
| - | ... to contain the following lines: | ||
| - | < | ||
| - | 13 0 * * * / | ||
| - | Which will run the script every night at 12:13. | ||
| - | |||
| - | ==== Backup MySQL Database ===== | ||
| - | This script will dump a given database to a '' | ||
| - | < | ||
| - | |||
| - | BACKUP_DIR=/ | ||
| - | DATE=$(date +%Y%m%d) | ||
| - | |||
| - | mysqldump --opt -u root -p' | ||
| - | |||
| - | exit 0 | ||
| - | </ | ||
| - | |||
| - | ==== Backup PostgreSQL Database ===== | ||
| - | This script will dump a given database to a '' | ||
| - | < | ||
| - | |||
| - | # set the user's Postgres password in the variable because we are | ||
| - | # not using pg_dump interactively, | ||
| - | export PGPASSWORD=" | ||
| - | |||
| - | # Grab the current date and save it to the DATE variable. | ||
| - | # February 22, 2010 would look like this: 20100222 | ||
| - | DATE=$(date +%Y%m%d) | ||
| - | |||
| - | # Backup the PostgreSQL dspace database at 12:15 every night | ||
| - | / | ||
| - | |||
| - | exit 0</ | ||
| - | ==== Cleanup Old Backups ==== | ||
| - | This script will search the specified backup directory for backup files older than 2 weeks and delete them. Make sure you don't delete backup scripts or non-backup files (directories, | ||
| - | < | ||
| - | |||
| - | BACKUP_DIR="/ | ||
| - | |||
| - | # Find files older than 2 weeks and delete them | ||
| - | find ${BACKUP_DIR} -type f \! -newermt "2 weeks ago" \! -name " | ||
| - | |||
| - | exit 0</ | ||
backup.1287187293.txt.gz · Last modified: by aorth
