This tutorial provides a quick walk-through of setting up a backup and recovery scenario using a Barman server and a PostgreSQL server. It covers:
- Configuring the database server to allow Barman to collect data via streaming replication
- Installing Barman on an Ubuntu system
- Configuring Barman for streaming replication
- Validating a Barman configuration
- Running a full backup
- Restoring a full backup
-
Run:
docker-compose -f step01-db-setup/docker-compose.yaml up -d docker exec -it -u postgres pg /bin/bash
-
Follow the instructions in step01-db-setup/README.md
-
Run:
docker-compose -f step01-db-setup/docker-compose.yaml down
...to clean up the containers before starting the next step.
-
Run:
docker-compose -f step02-backup-setup/docker-compose.yaml up -d docker exec -it backup /bin/bash
-
Follow the instructions in step02-backup-setup/README.md
-
Run:
docker-compose -f step02-backup-setup/docker-compose.yaml down
...to clean up the containers before starting the next step.
-
Run:
docker-compose -f step03-backup/docker-compose.yaml up -d docker exec -it -u barman backup /bin/bash
-
Follow the instructions in step03-backup/README.md
-
Run:
docker-compose -f step03-backup/docker-compose.yaml down
...to clean up the containers before starting the next step.
-
Run:
docker-compose -f step04-restore/docker-compose.yaml up -d docker exec -it -u barman backup /bin/bash
-
Follow the instructions in step04-restore/README.md
-
Run:
docker-compose -f step04-restore/docker-compose.yaml down
...to clean up the containers.
The build system is quite simplistic: two scripts under ./build
build/build-images.sh
will build and tag the 8 images used by the Compose files under step01-step04. Changes can then be tested locally.build/push-images.sh
will push these images up to Docker Hub. Note that this currently requires you to be... Me.
If changes are made to the scenario steps that affect the intermediate backups in steps #2 or #3, you'll need to create new archives of the pg
backup directory at the conclusion of BOTH steps #2 and #3.
tar cvfz pg.tar.gz -C ~ pg
Then copy that archive into the build directory for the next steps (build/step03/backup/barman
and build/step04/backup/barman
respectively).
I still need to take time to automate this a bit more :)