- https://www.mydbops.com/blog/postgresql-17-incremental-backup-pg-basebackup-pg-combinebackup
- https://www.dbi-services.com/blog/postgresql-17-support-for-incremental-backups/
Start with a clean database (OPTIONAL!)
docker compose down --remove-orphans --volumes
docker compose up database
Stop the database and uncomment the mounting of the pg_hba.conf in the volumes
section of the docker-compose.yml
file and start the database again.
docker compose exec --user postgres database psql -c "alter system set summarize_wal='on'"
Run the base backup
docker compose run --rm pg-backup-base
Do an incremental backup
docker compose run --rm pg-backup-incremental-1
Make a change to the database
docker compose run --rm change
Do another incremental backup
docker compose run --rm pg-backup-incremental-2
docker compose run --rm pg-backup-restore
Start the restored database
docker compose up restored-database -d
Promote to read-write
docker compose exec --user postgres restored-database pg_ctl promote -D /var/lib/postgresql/data