简体   繁体   English

依靠Rackspace Cloud Server备份映像是处理mysql备份的好方法吗?

[英]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? 与其每天早上运行mysqldump(例如),不如仅仅依靠Rackspace Cloud Servers进行的每日服务器映像备份会好吗? 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. 由于mysqldump可以使用数据库的内部状态,因此建议使用cron作业定期执行mysqldump,然后使用Cloud Backups备份mysqldump的输出。

Something like the following for the cron job: 对于cron作业,如下所示:

#!/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/cloud/backup/

http://www.rackspace.com/knowledge_center/article/rackspace-cloud-backup-backing-up-databases 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打开并写入的任何文件。 MySQL dump performs a lock to ensure that nothing is being modified while the dump is taking place. MySQL转储执行锁定,以确保在进行转储时不进行任何修改。

I would recommend using something like Holland Backup as it provides a framework for backing up MySQL. 我建议使用像Holland Backup这样的工具,因为它提供了用于备份MySQL的框架。

The benefit of using something like Holland is that you have a bit more control over the process. 使用Holland之类的好处是您可以对过程进行更多控制。 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. Holland还会进行检查以确保您有足够的可用空间来执行备份。

The default provider is mysqldump, but there are options for other providers such as using XtraBackup. 默认提供程序是mysqldump,但是其他提供程序也有选项,例如使用XtraBackup。

Rackspace Image is not an ideal way to perform a MySQL backup, Cloud Image is like a snapshot to the entire server! Rackspace Image不是执行MySQL备份的理想方法,Cloud Image就像整个服务器的快照! You'd have to use Rackspace Cloud Backup instead, not a Cloud Image. 您必须改为使用Rackspace Cloud Backup,而不是Cloud Image。 However, Holland Backup is a good way to perform scheduled backup using Cron Jobs. 但是, Holland Backup是使用Cron Jobs执行计划备份的好方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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