简体   繁体   English

增量备份和使用 PgBackRest 进行 WAL 归档的区别

[英]Difference between incremental backup and WAL archiving with PgBackRest

As far as I understood据我了解

  • WAL archiving is pushing the WAL logs to a storage place as the WAL files are generated当 WAL 文件生成时,WAL 归档将 WAL 日志推送到存储位置
  • Incremental backup is pushing all the WAL files created since the last backup增量备份正在推送自上次备份以来创建的所有 WAL 文件

So, assuming my WAL archiving is setup correctly所以,假设我的 WAL 归档设置正确

  1. Why would I need incremental backups?为什么我需要增量备份?
  2. Shouldn't the cost of incremental backups be almost zero?增量备份的成本不应该几乎为零吗?

Most of the documentation I found is focusing on a high level implementation (eg how to setup WAL archiving or incremental backups) vs the internal ( what happens when I trigger an incremental backup)我发现的大多数文档都侧重于高级实现(例如如何设置 WAL 归档或增量备份)与内部实现(当我触发增量备份时会发生什么)

My question can probably be solved with a link to some documentation, but my google-fu has failed me so far我的问题可能可以通过一些文档的链接来解决,但到目前为止我的 google-fu 失败了

Backups are not copies of the WAL files, they're copies of the cluster's whole data directory.备份不是 WAL 文件的副本,而是集群整个数据目录的副本。 As it says in the docs , an incremental backup contains:正如文档中所说,增量备份包含:

those database cluster files that have changed since the last backup (which can be another incremental backup, a differential backup, or a full backup)自上次备份(可以是另一个增量备份、差异备份或完整备份)后更改的那些数据库集群文件

WALs alone aren't enough to restore a database;仅 WAL 不足以恢复数据库; they only record changes to the cluster files, so they require a backup as a starting point.它们只记录对集群文件的更改,因此它们需要备份作为起点。

The need for periodic backups (incremental or otherwise) is primarily to do with recovery time.定期备份(增量或其他)的需要主要与恢复时间有关。 Technically, you could just hold on to your original full backup plus years worth of WAL files, but replaying them all in the event of a failure could take hours or days, and you likely can't tolerate that kind of downtime.从技术上讲,您可以保留原始完整备份以及数年的 WAL 文件,但是在发生故障时重放它们可能需要数小时或数天,而且您可能无法容忍这种停机时间。

A new backup also means that you can safely discard any older WALs (assuming you don't still need them for point-in-time recovery), meaning less data to store, and less data whose integrity you're relying on in order to recover.新的备份还意味着您可以安全地丢弃任何旧的 WAL(假设您仍然不需要它们进行时间点恢复),这意味着要存储的数据更少,并且您依赖其完整性的数据更少恢复。

If you want to know more about what pgBackRest is actually doing under the hood, it's all covered pretty thoroughly in the Postgres docs .如果您想更多地了解 pgBackRest 在幕后实际做了什么, Postgres 文档中对所有内容进行了非常彻底的介绍。

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

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