From e60f0e10c8fece47af2e3e8a0e824292fa851f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@debian.org> Date: Tue, 10 Dec 2024 16:32:00 -0500 Subject: [PATCH] remove old backups only after testing new ones, improve bootstrap --- howto/postgresql.md | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/howto/postgresql.md b/howto/postgresql.md index c7542955..96d4c738 100644 --- a/howto/postgresql.md +++ b/howto/postgresql.md @@ -2146,16 +2146,48 @@ This will eventually become the default, but for now that needs to be added by hand, either in `hiera/roles/$ROLE.yaml` or `hiera/nodes/$FQDN.yaml` if the node does not have a role. +The configuration of the new backup can be tested with this command on +the client: + + sudo -u postgres pgbackrest --stanza=`hostname -f` check + +For example, this was done to test `weather-01`: + + root@weather-01:~# sudo -u postgres pgbackrest --stanza=weather-01.torproject.org check + Then Puppet needs to run on the "client" (the PostgreSQL server) and on the "repository" (the backup server, currently `backup-storage-01`). The full backups will run in the coming week, -but can be ran manually with: +but can be ran manually on the repository server with: systemctl start pgbackrest-backup-full@$HOSTNAME.service For example: - systemctl start pgbackrest-backup-full@materculae.service + root@backup-storage-01:~# systemctl start pgbackrest-backup-full@materculae.service + +You should be able to see information about that backup with the +`info` command on the client: + + sudo -u postgres pgbackrest --stanza=`hostname -f` info + +For example: + +``` +root@weather-01:~# sudo -u postgres pgbackrest --stanza=`hostname -f` info +stanza: weather-01.torproject.org + status: ok + cipher: none + + db (current) + wal archive min/max (15): 000000010000001F00000004/00000001000000210000002F + + full backup: 20241118-202245F + timestamp start/stop: 2024-11-18 20:22:45 / 2024-11-18 20:28:43 + wal start/stop: 000000010000001F00000009 / 000000010000001F00000009 + database size: 40.3MB, database backup size: 40.3MB + repo1: backup set size: 7.6MB, backup size: 7.6MB +``` Finally, the old backup directory needs to be moved out to avoid warnings on the old storage server (currently `bungei`): @@ -2170,15 +2202,6 @@ The old backups should be scheduled for removal with: echo rm -r /srv/backups/pg/$HOSTNAME.old | at now + 30 days -The configuration of the new backup can be tested with this command on -the client: - - sudo -u postgres pgbackrest --stanza=$FQDN check - -For example, this was done to test `weather-01`: - - root@weather-01:~# sudo -u postgres pgbackrest --stanza=weather-01.torproject.org check - ### Manual configuration Those instructions are kept for historical reference, and are all -- GitLab