简体   繁体   中英

Is relying on Rackspace Cloud Server backup images an okay way to handle mysql backups?

Rather than running mysqldump (eg) every morning, would it be fine to just rely on the daily server image backups that Rackspace Cloud Servers do? Or, is there a future headache that I'm not seeing?

The concern would be a potentially inconsistent state if any database operation occurred while the backup image was being created. Some of the database transactions may not have been flushed to disk yet, still residing in memory.

Since mysqldump can use the internal state of the database, I'd recommend using a cron job to regularly perform a mysqldump, and then backing up the output of the mysqldump with Cloud Backups.

Something like the following for the cron job:

#!/bin/sh
mysqldump -h DB_HOST -u DB_USER -p'DB_PASSWORD' \
DB_NAME > YOUR_WEB_ROOT/db_backup.sql gzip -f PATH_TO_BACKUPS/db_backup.sql

References:

http://www.rackspace.com/cloud/backup/

http://www.rackspace.com/knowledge_center/article/rackspace-cloud-backup-backing-up-databases

Indeed, the future headache would be trying to restore data that was possibly in an inconstant state when the image was taken.

The problem stems from any files that MySQL had open and writing to at the time of the image. MySQL dump performs a lock to ensure that nothing is being modified while the dump is taking place.

I would recommend using something like Holland Backup as it provides a framework for backing up MySQL.

The benefit of using something like Holland is that you have a bit more control over the process. For example, you can control when to purge out older backups that are no longer needed.

Holland also does a check to make sure you have enough free space to perform a backup.

The default provider is mysqldump, but there are options for other providers such as using XtraBackup.

Rackspace Image is not an ideal way to perform a MySQL backup, Cloud Image is like a snapshot to the entire server! You'd have to use Rackspace Cloud Backup instead, not a Cloud Image. However, Holland Backup is a good way to perform scheduled backup using Cron Jobs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM