Are there any documented techniques for speeding up mySQL dumps and imports?
This would include my.cnf settings, using ramdisks, etc.
Looking only for documented techniques, preferably with benchmarks showing potential speed-up.
Are there any documented techniques for speeding up mySQL dumps and imports?
This would include my.cnf settings, using ramdisks, etc.
Looking only for documented techniques, preferably with benchmarks showing potential speed-up.
http://www.maatkit.org/ has a mk-parallel-dump and mk-parallel-restore
If you’ve been wishing for multi-threaded mysqldump, wish no more. This tool dumps MySQL tables in parallel. It is a much smarter mysqldump that can either act as a wrapper for mysqldump (with sensible default behavior) or as a wrapper around SELECT INTO OUTFILE. It is designed for high-performance applications on very large data sizes, where speed matters a lot. It takes advantage of multiple CPUs and disks to dump your data much faster.
There are also various potential options in mysqldump such as not making indexes while the dump is being imported - but instead doing them en-mass on the completion.
If you are importing to InnoDB the single most effective thing you can do is to put
innodb_flush_log_at_trx_commit = 2
in your my.cnf, temporarily while the import is running. You can put it back to 1 if you need ACID.
Make sure you are using the --opt option to mysqldump when dumping. This will use bulk insert syntax, delay key updates, etc...
If you are ONLY using MyISAM tables, you can safely copy them by stopping the server, copying them to a stopped server, and starting that.
If you don't want to stop the origin server, you can follow this:
But I'm pretty sure your copy-to server needs to be stopped when you put them in place.
There is an method for using LVM snapshots for backup and restore that might be an interesting option for you.
Instead of doing a mysqldump, consider using LVM to take snapshots of your MySQL data directories. Using LVM snapshots allow you to have nearly real time backup capability, support for all storage engines, and incredibly fast recovery. To quote from the link below,
"Recovery time is as fast as putting data back and standard MySQL crash recovery, and it can be reduced even further."
http://www.mysqlperformanceblog.com/2006/08/21/using-lvm-for-mysql-backup-and-replication-setup/