From 668ab447a27706b99fd1587e408d817b8607ae73 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Fri, 7 Aug 2026 15:02:55 -0400 Subject: [PATCH] Exclude so_telegraf from the nightly Postgres backup pg_dumpall dumped every database, and so_telegraf dominated the result: it is the only database that grows with grid size and metric volume, while everything else in the cluster is small and mostly static. Nothing is lost by skipping it. The data is transient metrics on a 14-day retention window, roles are globals so the per-minion telegraf logins are still dumped, and the database itself is rebuilt after a restore without operator action -- init-db.sh recreates it (run on every highstate by postgres_bootstrap_soc_db, not just on a fresh volume), telegraf_users.sls re-provisions the roles and schema, and Telegraf recreates its tables on first write. --- salt/postgres/tools/sbin/so-postgres-backup | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/salt/postgres/tools/sbin/so-postgres-backup b/salt/postgres/tools/sbin/so-postgres-backup index 08a73e3a4..4de5adf62 100644 --- a/salt/postgres/tools/sbin/so-postgres-backup +++ b/salt/postgres/tools/sbin/so-postgres-backup @@ -47,7 +47,12 @@ trap 'rm -f "$TMPFILE"' EXIT # Dump all databases and roles, compress. Write to a temp file so the final # filename only ever appears for a complete, verified backup. -if ! docker exec so-postgres pg_dumpall -U postgres | gzip > "$TMPFILE"; then +# +# so_telegraf is excluded: it is transient metrics on a short retention window, +# it dominates the dump size, and it is rebuilt automatically after a restore -- +# init-db.sh recreates the database and Telegraf recreates its tables on first +# write. Roles are globals, so the per-minion telegraf logins are still dumped. +if ! docker exec so-postgres pg_dumpall -U postgres --exclude-database=so_telegraf | gzip > "$TMPFILE"; then log "ERROR: pg_dumpall/gzip failed; backup aborted" exit 1 fi