Copying, compressing, and decompressing huge files (often across a network) are common tasks when administering MySQL, initializing servers, cloning slaves, and performing backups and recovery operations. The fastest and best ways to do these jobs are not always the most obvious, and the difference between good and bad methods can be significant. This appendix shows some examples of how to copy a large backup image from one server to another using common Unix utilities.
It’s common to begin with an uncompressed file, such as one server’s InnoDB tablespace and log files. You also want the file to be decompressed when you finish copying it to the destination, of course. The other common scenario is to begin with a compressed file, such as a backup image, and finish with a decompressed file.
If you have limited network capacity, it’s usually a good idea to send the files across the network in compressed form. You might also need to do a secure transfer, so your data isn’t compromised; this is a common requirement for backup images.
The task, then, is to do the following efficiently:
(Optionally) compress the data.
Send it to another machine.
Decompress the data into its final destination.
Verify the files aren’t corrupted after copying.
We’ve benchmarked various methods of achieving these goals. The rest of this appendix shows you how we did it and what we found to be the fastest way.
For many of the purposes we’ve discussed in this book, such ...