Mysql – How to backup big MySQL database on Linux

backupMySQL

I want to backup MySQL database which is around 200GB. How should I do it?

Using mysqldump – I feel backing up 200GB database on which there are continuous writes are going on. Is it a good idea? I can't stop the inserts of the database. So I want to take kind of hot backup. I am aware about the mysqlhotcopy..which only backs up myisam tables. and i have my tables in Innodb.

Please give me some thoughts / comments on how I should go about it?

Best Answer

There is a number of possile backup methods described in the MySQL docs. In your case I'd clearly recommend the method described in the "Making Backups Using a File System Snapshot" section where you issue a FLUSH TABLES WITH READ LOCK, make a filesystem snapshot (LVM or otherwise) and UNLOCK TABLES. After that, you can just copy off the database files to backup media.

The other options are clearly inferior. Mysqldump will create lengthy load spikes and table locks which will prevent your INSERTs for a long time, especially with very large tables.

Replication is an even less elegant solution as MySQL has no mechanisms to ensure that your replica set is identical - you will just have to hope that this is the case - really not what you would want for a backup.