大网数据广告活动
服务器运维问答

Principles of creating a consistent (point-in-time) backup

· 52CE 我爱测

As far as my experience goes, in order to create a useful, and consistent backup, one must involve the application handling the data to be backed up . I'd like to validate my findings with fellow sysadmins. Consider the situation…

问题原文

原帖链接 · roeme · CC BY-SA 3.0

As far as my experience goes, in order to create a useful, and consistent backup, one must involve the application handling the data to be backed up. I'd like to validate my findings with fellow sysadmins.

Consider the situation that an application has a file opened for R/W, and while held open, a separate backup process reads the file. (And is allowed to do so – if we'd use flocks, and mandatory ones instead of advisory at that, we'd have to involve the application anyway). It should be commonly agreed upon that the backup created of this open file might be inconsistent.

Using snapshots on the filesystem level cannot completely alleviate this; as we can't guarantee that at snapshot point in time t all applications have written consistent files to the disk (assume that at t we are able to have flushed all buffers).

So, when creating a proper backup plan, one must always keep in mind on which applications write data, and how they're doing it – and make sure that they write consistent files to disk before taking a snapshot/backup.

Do you agree with me, or have I made fundamental mistakes when pondering this?

(Please do not answer this question with any specific HOWTO's, as this is about general, "high-level" principles. Also, just to make sure, this is not about DB's, as the problem has been solved there already).

已采纳解答

原帖链接 · BillThor · CC BY-SA 3.0

You seem to have a good understanding of the issues.

The standard snapshot approach I have seen is to shutdown the services that would be writing to the file system, break the snapshot and restart the services. Backup the side not being written.

Another approach is to be able to export a point in time set of data from the application. Then backup the exported data. This is one approach that databases may use. Data may be transformed during the export, so there may be additional steps to importing the data.

An alternative approach I have used with databases, is to mark files as being backed up while they are copied. This may defer updates while the backup is running, or may allow replay of the changes at a later time. This requires change logs which also need to be backed up.

I generally exclude database files from my standard backups, and use one of the alternate approaches to get point in time data from the database.

Plan carefully before recovering a database. I've rarely needed to recover a full database to a point in time. Cold backups (database shutdown) may be appropriate for a database used in training. I've regretted providing similar rollback for testing databases.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-07-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。