Jun 29 2011

Website & Webapplication Policies for Backup of Databases and Files

AnnexCore

When investing thousands of dollars into your web application, proper budget allocation toward a backup policy should be considered. Anything can happen from an employee accidentally deleting some necessary files, to a malicious code attacking your system, and even the most notorious, hackers! Your aim should be to automate process so you can focus on growing your business!

Database Backup

At AnnexCore we recommend separating the database and file back-ups process, and maintain a simple 3-copy rule for moderate protection. We start with a derivative of the MySQL Replication process. The general setup requires specific configurations to the master to enable binary logging (binlog), configure a unique server ID, and may require a server restart. The binlog takes a note of every change to the data as a snapspot, you should record the position of the binary log in the master. This all will be copied over to the Slave server, with this information it can start itself up with that snapshot since it will know what binlog position it will need to start from. This will allow you to recreate the database at any query or point of time from when it was copied to the last entry (requires binlog position replaying).

With this method you have to backup both Snapshots and binary logs. We recommend that you take snapshots of the Slave’s data directory daily and copy it to another server or use a service like BlackBlaze which is $5/month.  This data directory then should be synchronized at the minimum weekly to your local copy and Amazon S3 server using rsync. The binlogs should be continuously copied from the master to both the slave then a locally and Amazon S3 servers.

File Backup

The methods we discussed above can be used for creating a file backup process as well. Using BlackBlaze you can also copy your files to their service, or another service is Tarsnap which charges based on storage & bandwidth. You can also use Rsync to backup files locally and onto Amazon S3 depending on how often you update those files.

Backup Policies

At the end of the day you want to make certain you can recover from major losses, so you should integrate protocols to manually check backups periodically. It’s also a good idea to keep old backups, which IBM has a great model to mimic.

  • Once per week, recycle all daily diskettes except the Friday diskette.
  • Once per month, recycle all Friday diskettes except for the one from the last Friday of the month. This makes the last four Friday backups always available.
  • Once per quarter, recycle all monthly diskettes except for the last one. Keep the last monthly diskette from each quarter indefinitely, preferably in a different building.

Our methods is a general recommendation, and isn’t a one-size fits all type of solution. It should be capable of handling most small to mid-sized websites.

 

This post may contain affiliate links for which we receive commission if you visit a link and purchase something based off our recommendation. By making a purchase through an affiliate link, you won't be charged anything extra. We only recommend products and services we've thoroughly tested ourselves and trust.