You can use replication as a backup solution by replicating data from the master to a slave, and then backing up the data slave. Because the slave can be paused and shutdown without affecting the running operation of the master you can produce an effective snapshot of 'live' data that would otherwise require a shutdown of the master database.
How you back up the database will depend on the size of the database and whether you are backing up only the data, or the data and the replication slave state so that you can rebuild the slave in the event of failure. There are therefore two choices:
If you are using replication as a solution to enable you to backup
the data on the master, and the size of your database is not too
large, then the mysqldump tool may be suitable.
See
Section 6.2.1.1, “Backing up using mysqldump”.
For larger databases, where mysqldump would be
impractical or inefficient, you can backup the raw data files
instead. Using the raw data files option also means that you can
backup the binary and relay logs that will enable you to recreate
the slave in the event of a slave failure. For more information,
see
Section 6.2.1.2, “Backing up raw data”.

User Comments
Add your own comment.