How to Backup Large MySQL Databases
Posted in General on June 15th, 2010 by Paul
Lately, I’ve been getting more familiar with different backup procedures and it made me want to update everyone on our current recommended Scrutinizer backup procedure.
With networks continuously growing in size, it’s common for a NetFlow collector’s database to grow in excess of 100 gigabytes, and in some cases I’ve seen databases grow to be over a terabyte! When databases grow this large we find that using MySQL Administrator for backups becomes slow and CPU intensive. MySQL Administrator is good for a general purpose backup tool with no application knowledge of what’s being backed up, but for Scrutinizer the additional overhead can degrade performance. So we’ve found a better solution for these large backups known as Robocopy. You can get Robocopy by downloading the Windows 2003 Resource Kit.
Backing up the data!
Scrutinizer’s history and configuration data are stored in \Scrutinizer\mysql\data and we don’t recommend backing up this data directly, but instead copying the data to a backup location and running the backup on that directory.
Once you’ve installed the Resource Kit you can use the following command to create a full backup for your Scrutinizer data directory:
C:\robocopy “source_directory” “destination_directory” /MIR
The /MIR attribute activates mirror mode which adds and removes any files in the destination directory to match the source directory.
Scheduling Backups
The best time to do a backup is when your network is under small load and Scrutinizer is least busy on your system. With that in mind, Scrutinizer does routine maintenance tasks at midnight, so it’s recommended that the backups are scheduled for 3am.
To schedule the Robocopy backups, open up Windows Task Scheduler and create a new task with a Trigger to start at 3am (daily, weekly, monthly, it’s up to you). Next, you need to create an Action to “Start a program” and locate the Robocopy executable (“C:\Program Files\Windows Resource Kits\Tools\robocopy.exe”). You will also need to add source, destination and /MIR to the “Add arguments:” field (e.g. “C:\Program Files\Scrutinizer\mysql\data” C:\Backup /MIR).
Now, you have a backup of your Scrutinizer data that can be moved or copied off of your Scrutinizer server without the risk of data corruption.
Paul DubeVisit our website to download a 30 day trial of Scrutinizer
Join the NetFlow Developments group on LinkedIn.
Tags: how to guide, Network Traffic Analysis, robocopy, Scrutinizer backup procedure