Incremental backup and restore
This tutorial will show you how to do an incremental backup and a restore using pgmoneta.
Preface
This tutorial assumes that you have an installation of PostgreSQL 17+ and pgmoneta.
See Install pgmoneta for more detail.
Full backup
pgmoneta-cli -c pgmoneta.conf backup primarypgmoneta-cli -c pgmoneta.conf backup primarywill take a full backup of the [primary] host.
(pgmoneta user)
List backups
pgmoneta-cli -c pgmoneta.conf list-backup primarypgmoneta-cli -c pgmoneta.conf list-backup primary(pgmoneta user)
Incremental backup
pgmoneta-cli -c pgmoneta.conf backup primary newestpgmoneta-cli -c pgmoneta.conf backup primary newestwill take an incremental backup of the [primary] host.
Note that currently branching is not allowed for incremental backup -- a backup can have at most 1 incremental backup child.
(pgmoneta user)
List backups
pgmoneta-cli -c pgmoneta.conf list-backup primarypgmoneta-cli -c pgmoneta.conf list-backup primary(pgmoneta user)
Restore
pgmoneta-cli -c pgmoneta.conf restore primary newest current /tmp/pgmoneta-cli -c pgmoneta.conf restore primary newest current /tmp/will take the latest backup and all Write-Ahead Log (WAL) segments and restore it into the /tmp/primary-<timestamp> directory for an up-to-date copy.
The 2nd to last parameter allows
currentmeans copy the Write-Ahead Log (WAL ), and restore to first stable checkpointname=Xmeans copy the Write-Ahead Log (WAL ), and restore to the label specifiedxid=Xmeans copy the Write-Ahead Log (WAL ), and restore to the XID specifiedtime=Xmeans copy the Write-Ahead Log (WAL ), and restore to the timestamp specifiedlsn=Xmeans copy the Write-Ahead Log (WAL ), and restore to the Log Sequence Number (LSN) specifiedinclusive=Xmeans that the restore is inclusive of the specified informationtimeline=Xmeans that the restore is done to the specified information timelineaction=Xmeans which action should be executed after the restore (pause, shutdown)primarymeans that the cluster is setup as a primaryreplicameans that the cluster is setup as a replica
(pgmoneta user)