Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure postgres to make incremental backups by default #532

Open
chambm opened this issue Nov 7, 2019 · 2 comments
Open

Configure postgres to make incremental backups by default #532

chambm opened this issue Nov 7, 2019 · 2 comments

Comments

@chambm
Copy link
Contributor

chambm commented Nov 7, 2019

Possibly as a startup option. Saved to /export. I may implement this myself when I set up the 19.09 image on Jetstream, but I figure it'd be good to get comments.

@chambm
Copy link
Contributor Author

chambm commented Jun 2, 2021

If it helps anyone here's the lograte config file I put in /etc/logrotate.d to backup the DB:

/export/pg_backup/db-backup-hourly.sql.gz {
  hourly
  missingok
  rotate 23
  nocompress
  nocreate
  postrotate
  sudo -upostgres pg_dumpall --file=/export/pg_backup/db-backup-hourly.sql
  sudo chmod 664 /export/pg_backup/db-backup-hourly.sql
  sudo -upostgres gzip /export/pg_backup/db-backup-hourly.sql
  endscript
}

/export/pg_backup/db-backup-daily.sql.gz {
  daily
  missingok
  rotate 6
  nocompress
  nocreate
  postrotate
  sudo -upostgres pg_dumpall --file=/export/pg_backup/db-backup-daily.sql
  sudo chmod 664 /export/pg_backup/db-backup-daily.sql
  sudo -upostgres gzip /export/pg_backup/db-backup-daily.sql
  endscript
}

/export/pg_backup/db-backup-weekly.sql.gz {
  weekly
  missingok
  rotate 3
  nocompress
  nocreate
  postrotate
  sudo -upostgres pg_dumpall --file=/export/pg_backup/db-backup-weekly.sql
  sudo chmod 664 /export/pg_backup/db-backup-weekly.sql
  sudo -upostgres gzip /export/pg_backup/db-backup-weekly.sql
  endscript
}

/export/pg_backup/db-backup-monthly.sql.gz {
  monthly
  missingok
  rotate 12
  nocompress
  nocreate
  postrotate
  sudo -upostgres pg_dumpall --file=/export/pg_backup/db-backup-monthly.sql
  sudo chmod 664 /export/pg_backup/db-backup-monthly.sql
  sudo -upostgres gzip /export/pg_backup/db-backup-monthly.sql
  endscript
}

@bgruening
Copy link
Owner

@chambm please see the new image 24.1. It also has a new PG version, I would be happy to accept a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants