This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
postgresql [2018/07/24 15:21] mstraub [Incremental Backups on Localhost] |
postgresql [2018/08/27 13:41] mantis |
||
---|---|---|---|
Line 58: | Line 58: | ||
==== Setting a password for user postgres ==== | ==== Setting a password for user postgres ==== | ||
<code sql> | <code sql> | ||
- | alter user postgres with password 'password'; | + | \password postgres |
</code> | </code> | ||
Line 708: | Line 708: | ||
sudo -u postgres pgbackrest --stanza=STANZANAME --type=incr --log-level-console=detail backup | sudo -u postgres pgbackrest --stanza=STANZANAME --type=incr --log-level-console=detail backup | ||
- | Make regular backups via cronjob | + | Make **regular backups via cronjob** |
<file - /etc/cron.d/pgbackrest> | <file - /etc/cron.d/pgbackrest> | ||
Line 716: | Line 716: | ||
</file> | </file> | ||
- | Restore latest backup. The cluster must be stopped and the cluster directory must exist and be empty. | + | **Restore latest backup.** The cluster must be stopped and the cluster directory must exist and be empty. |
sudo systemctl stop postgresql@9.5-CLUSTERNAME | sudo systemctl stop postgresql@9.5-CLUSTERNAME | ||
Line 724: | Line 724: | ||
sudo -u postgres pgbackrest --stanza=STANZANAME --log-level-console=detail restore | sudo -u postgres pgbackrest --stanza=STANZANAME --log-level-console=detail restore | ||
sudo systemctl start postgresql@9.5-CLUSTERNAME | sudo systemctl start postgresql@9.5-CLUSTERNAME | ||
+ | |||
+ | To **restore a specific backup** use ''%%--set%%'' with the name of a folder in ''/var/lib/pgbackrest/backup/STANZANAME'', e.g.: | ||
+ | |||
+ | sudo -u postgres pgbackrest --set=20180724-144511F --stanza=STANZANAME --log-level-console=detail restore | ||
+ | |||
+ | You can also copy the contents of ''/var/lib/pgbackrest'' to a different device and restore it there. | ||
+ | |||
+ | Log files can be found in ''/var/log/pgbackrest''. | ||
====== Performance Tuning ====== | ====== Performance Tuning ====== | ||