Open knutole opened 8 years ago
The current idea is to tweak the "postgis" docker so that it automatically restores a dump if started with an empty cluster and finds such dumps in a known location. Such mechanism would also work for automating PostgreSQL upgrades (and PostGIS major upgrades).
There are two different ways (at least) to do backups, and we might should do both:
postgis_store
docker volume to eg. postgis_backup
. postgis_store
and postgis_backup
and which constantly copies over (maybe file per file, detecting diffs?)docker export
'ing the entire postgis_store
every once in a while (probably not a good idea).postgis_backup
? pg_dump
, only backup up what's new?In a way, it seems it would be nice to do replication unto a postgis_backup
container (or several), which would then serve both purposes (backup + future load-balancing). But there might be unknown caveats to this approach.
The pg_dump based backup script (https://github.com/systemapic/wu/blob/242205ac7ba55b53d9a65264e6c331b0a76c47de/scripts/postgis/backup_databases.sh), run inside the systemapic/wu docker, backups the dev2 database cluster (from postgis_store_dev2) which is ~8.2GB in 7 minutes and 25 seconds, creating a 2.5G dump directory.
I'm doing some research on replication based backups
Cool. It seems 1 minute per GB might be too much, as soon as we get into the hundreds of GB's (especially if there's no append-mode for pg_dump?).
No append-mode, no. The only append-mode way is with WAL backup: http://www.postgresql.org/docs/current/static/continuous-archiving.html
I'm running some tests locally to better understand how it works.
What I understood so far is that you basically make a copy of the PGDATA directory and separately archive WAL files which can be done incrementally and automated (and even streamed remotely to an hot standby replication server).
for the record: right now an automatic pg_dump based backup is running (backup Docker), and scripts for restoring from backups are available (https://github.com/systemapic/docker-systemapic/issues/7#issuecomment-172011486) -- maybe this ticket should be closed, and a new one filed for replication-based approach.
and possibly also another one to make sure the "backup_store" gets saved in a safer place than a docker container :)
yes, will do this once i've run things on tx.
We're not currently backing up any data, and need to do so. Would be great with some feedback on how this is best accomplished.