HAPI FHIR Data
FHIR messages Backup & Restore.
Validated messages from HAPI FHIR will be stored in PostgreSQL database.
The following content will detail the backup and restore process of this data.
Backups
This section assumes Postgres backups are made using
pg_basebackup
Postgres (Hapi-FHIR)
To start up HAPI FHIR and ensure that the backups can be made, ensure that you have created the HAPI FHIR bind mount directory (eg./backup)
Disaster Recovery
NB! DO NOT UNTAR OR EDIT THE FILE PERMISSIONS OF THE POSTGRES BACKUP FILE
Postgres (HAPI FHIR)
Preliminary steps:
Do a
destroy
offhir-datastore-hapi-fhir
using the CLI binary (./platform-linux for linux)Make sure the Postgres volumes on nodes other than the swarm leader have been removed as well! You will need to ssh into each server and manually remove them.
Do an
init
offhir-datastore-hapi-fhir
using the CLI binary
After running the preliminary steps, run the following commands on the node hosting the Postgres leader:
NOTE: The value of the
REPMGR_PRIMARY_HOST
variable in your .env file indicates the Postgres leader
Retrieve the Postgres leader's container-ID using:
docker ps -a
. Hereafter calledpostgres_leader_container_id
Run the following command:
docker exec -t <postgres_leader_container_id> pg_ctl stop -D /bitnami/postgresql/data
Wait for the Postgres leader container to die and start up again. You can monitor this using:
docker ps -a
Run the following command:
docker rm <postgres_leader_container_id>
Retrieve the new Postgres leader's container-ID using
docker ps -a
, be weary to not use the oldpostgres_leader_container_id
Retrieve the Postgres backup file's name as an absolute path (/backups/postgresql_xxx). Hereafter called
backup_file
Run the following commands in the order listed :
Do a
down
offhir-datastore-hapi-fhir
using the CLI binary Example:./instant-linux package down -n=fhir-datastore-hapi-fhir --env-file=.env.*
Wait for the
down
operation to completeDo an
init
offhir-datastore-hapi-fhir
using the CLI binary Example:./instant-linux package init -n=fhir-datastore-hapi-fhir --env-file=.env.*
Postgres should now be recovered
Note: After performing the data recovery, it is possible to get an error from HAPI FHIR (500 internal server error) while the data is still being replicated across the cluster. Wait a minute and try again.
Last updated