Fastest method for taking MySQL Backup and Restore
Mydumper and Myloader are utility which allows you to perform extremely fast and reliable multi-threaded MySQL backup and restore. These tools are written in the C programming language.
Mydumper is a a tool for fast reliable logical backups. It is an alternative to mysqldump and has many advantages over mysqldump some of which are listed below:
· Multi-threaded backup tool which makes it a lot faster than mysqldump, as mysqldump is single threaded. It will be more advantage if you have very fast storage such as SSDs which can be much better utilized with multiple threads.
· The tool produces separate files for separate tables instead of one big monolithic file, making it easy to restore single tables. You can even break/chunk the table into multiple files which is super useful for cases where you have very large tables.
· The tool allows for multi-threaded restores, making restores an order of magnitude faster in comparison to restoring from mysqldump produced backups. This is especially true for large datasets.
· The Mydumper tool provides in-built compression, so that the backup files are written in compressed form.
When it comes to backing up and restoring MySQL database, most people usually use the very popular mysqldump. You know that mysqldump is very easy to use for a smaller database, it doesn’t work well with larger databases. It’s very slow for huge databases and very error prone when used for very big MySQL databases.
Install mydumper on ubuntu
# sudo apt-get install mydumper
Install mydumper for other linux:
# yum install glib2-devel mysql-devel zlib-devel pcre-devel openssl-devel cmake
Download mydumper – https://launchpad.net/mydumper [OR] (Directly here https://launchpad.net/mydumper/0.6/0.6.2/+download/mydumper-0.6.2.tar.gz)
# tar -xvzf mydumper-0.6.2.tar.gz
# cd mydumper-0.6.2
# cmake .
Example: mydumper -u USER -p PASSWORD -o /home/DESTINATION_DIR/DATABASE/ -B DATABASE
Example: myloader -u USER -p PASSWORD -B DATABASE -d /home/SOURCE_DIR/DATABASE/
This article will help with doing MySQL backups and restore in faster way.