HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Quick MySQL Backup

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
mysqlquickbackup

Problem

I have a database which is grown to 3GB and it has 3 MyISAM tables. And I have 4GB RAM. What will be the best (quick) way to backup this database without any performance lack.

Or mysqldump will work without any problem?

Edit
I am not looking for a very big file containing lot of SQL statements. Now, do I have more options? Like raw data export or mysqlhotcopy as I am looking for a quicker way because backing up MyISAM would acquire table locking?

And what are the limits of mysqldump and when it should be avoided?

Solution

mysqldump should be just fine. Since you have only 3GB of data, I expect the mysqldump to be decently fast (1-2 min as a single output). However, since your database is comprised of 3 MyISAM tables expect all three to be locked during the backup. Please keep mind that since tables are locked one at a time, you will not have point-in-time consistency across all tables in the database.

I have some scripts I wrote and still use to perform

  • parallel backups of separate databases



  • parallel backups of separate tables



If you are concerned with consistent data, you may need to implement something from Option 4 of the link I provided which executes "FLUSH TABLES WITH READ LOCK; SELECT SLEEP(86400);" in a separate session to lock all writes to all tables, perform the mysqldump(s), and then kill that session holding the tables locks.

If you are afraid to try executing this, you should look into using MySQL Replication. A slave server with the same data can be used to perform mysqldumps without imposing anything disk I/O or overall server load on the master database. You basically do these things on the DB Slave:

  • STOP SLAVE;



  • mysqldump



  • START SLAVE;



Give it a Try !!!

Context

StackExchange Database Administrators Q#6405, answer score: 2

Revisions (0)

No revisions yet.