r/wal-g-pg: Schedule weekly delete jobs

WAL-G slows down significantly when too many backups are kept.  We need
to periodically clean up old backups to maintain a reasonable level of
performance, and also keep from wasting space with useless old backups.
This commit is contained in:
2024-11-05 19:28:57 -06:00
parent eaf9cbef9a
commit 8b9cf1985a
6 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
[Unit]
Description=PostgreSQL Backup delete with WAL-G
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
Environment=PGDATA=/var/lib/pgsql/data
ExecStart=/usr/bin/wal-g-pg delete --config /etc/postgresql/wal-g.yml {{ wal_g_pg_delete_args }} --confirm
User=postgres

View File

@@ -0,0 +1,9 @@
[Unit]
Description=Periodic PostgreSQL backup delete with WAL-G
[Timer]
OnCalendar={{ wal_g_pg_delete_timer_schedule }}
Persistent=yes
[Install]
WantedBy=timers.target