It is not necessary to replay the WAL entries all the way to the end. This is particularly valuable for large databases, where it might not be convenient to take a full backup frequently. Since we can combine an indefinitely long sequence of WAL files for replay, continuous backup can be achieved simply by continuing to archive the WAL files. So we do not need a file system snapshot capability, just tar or a similar archiving tool. Any internal inconsistency in the backup will be corrected by log replay (this is not significantly different from what happens during crash recovery). We do not need a perfectly consistent file system backup as the starting point. This approach is more complex to administer than either of the previous approaches, but it has some significant benefits: If recovery is needed, we restore the file system backup and then replay from the backed-up WAL files to bring the system to a current state. However, the existence of the log makes it possible to use a third strategy for backing up databases: we can combine a file-system-level backup with backup of the WAL files. This log exists primarily for crash-safety purposes: if the system crashes, the database can be restored to consistency by “ replaying” the log entries made since the last checkpoint. The log records every change made to the database's data files. CaveatsĪt all times, PostgreSQL maintains a write ahead log (WAL) in the pg_wal/ subdirectory of the cluster's data directory. Recovering Using a Continuous Archive Backup 26.3.5. Making a Base Backup Using the Low Level API 26.3.4.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |