📜 ⬆️ ⬇️

Hot MySQL BackUp Creation Tools

Good day. Recently, I wondered about how to make hot BackUps `MySQL-servers - below is a compilation of the read. I want to say in advance that this post is rather a big note than a full-fledged article. I deliberately shy away from the description of syntax - a lot has already been written on this topic - I set myself another goal - to make a brief overview of the main methods with characteristic features:

1. Using the mysqldump utility. This program is extremely popular among web hosting users. Reading the contents of the tables, she creates a file with SQL instructions for later filling. But, as a rule, when using people forget about three key points:

Recovery: by dumping a file to the mysql utility via STDIN.

2. Using the mysqlhotcopy utility. Another tool from the regular set of MySQL. The idea is as follows: the base is put on a lock, after which the cp or scp files are copied to another location.

Recovery: by copying the saved files to the MySQL data directory.

3. Using LVM.
LVM is an extra layer between the file system and the hard disk itself. One of the remarkable features of LVM is the ability to remove an image from a volume on the fly. The scheme of actions will be the following: lock all database tables, take a snapshot from a volume, unlock tables.

Recovery: by copying the files saved from the image to the MySQL data directory.
')
4. Using replication. Despite the fact that many consider this option hemorrhoids, this method of reservation seems to me the most correct. The logic of this approach consists in constant synchronization of the main (master) server with the secondary (slave). Read more about replication here .

Recovery: output of the slave server to the master`a place, or recovery by one of the above methods (depending on the selected one).

Total: As you can see, each method has its pros and cons: there is hardly any sense in backing up a small forum using replicas, and bases where the count goes to gigabytes will hardly be conveniently picked up from files made by mysqldump, each method is good at certain conditions.

At this point I finish my story, I hope it will be useful for you. Thank you for your attention and see you again on the air. :)

Source: https://habr.com/ru/post/63394/


All Articles