Mysql – What are the consequences if I backup LIVE databases every 3-hours using thesqldump

backupdatabaseMySQL

If I am not mistaken, when executing mysqldump, it will lock the tables, isn't it? Erm, never mind, my question is:

What are the consequences if I backup LIVE databases hourly using mysqldump?

I have lots of databases (around 15), but the ones that I need to backup only 10 databases (2 of them are quite huge in size, around 40 mb). Thus, in my batch file, I execute mysqldump per databases not using "–all-" option.

I wanted to backup those important databases as often as I can, I am planning to do a backup every 3 hours. However, I am concerned with the performances, I afraid it will slow down my website. Any advise?

Best Answer

You will put a huge load on your database servers IO subsystem.

If you need to do this, then my advice would be to setup mysql replication to a second server and run the backup from there.

Technically once you have this replication running, the binary logs on your slave are good enough for point in time recovery, and you shouldn't need to run a full backup so often.

Also, when running the backup consider the --single-transation flag on mysqlbackup to avoid doing a table level lock on each table. This requires you are using InnoDB not MyISAM, which you should be doing anyway.