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!
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.
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.
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.