Configure backup
Purpose and Benefits
Bahmni has different artifacts in the system like patient documents, patient images, DB data etc. There is a possibility that unwanted events may happen such as hard drive failure or data loss due to some wrong SQL (eg: delete sql) mistakenly run by the user. Bahmni provides mechanism to backup all the artifacts so that if any unwanted event happen then we should be able to recover from the backup so that usage of Bahmni continues as usual at the earliest.
Configure MySQL Databases Backup/Restore
Install Tool
The Xtrabackup tool is used for MySQL database backup. This tool can be installed during the Bahmni installation. Change the inventory file to have the below configuration and rerun the Bahmni installation. The hosts specified in the inventory under mysql-backup-tool will be used to install tools in that particular hosts.
[mysql-backup-tool]
192.168.33.13Configurable parameters
Below are some of the configurable parameters.
| Key | Description | Default Value |
|---|---|---|
| path | Path to backup the files. Backed up files are stored in this path. | /data/openmrs (for openmrs database)/data/reports (for bahmni_reports database) |
| restore_path | Path from where the restore files are picked up. In order to restore a file, it has to be present in this configured location | /data/openmrs (for openmrs database)/data/reports (for bahmni_reports database) |
| retention_limit | Maximum number of files maintained. Beyond this, the system automatically replaces the old files with the new backed up files. | 2 |
openmrs:
path: /data/openmrs/
retention_limit: 2
restore_path: /data/openmrs/bahmni_reports:
path: /data/reports/
retention_limit: 2
restore_path: /data/reports/Configure Postgres Databases Backup/Restore
Install Tool
The Pgbackrest tool is used for Postgres database backup. This tool can be installed during the Bahmni installation. Change the inventory file to have the below configuration and rerun the Bahmni installation. The hosts specified in the inventory under postgres-backup-tool will be used to install tools in that particular hosts.
[postgres-backup-tool]
192.168.33.13Configurable parameters
Below are some of the configurable parameters.
| Key | Description | Default Value |
|---|---|---|
| path | Path to backup the files as well as restore the files from. Backed up files are stored in this path. The file to be restored should be present in this location configured. | /var/lib/pgbackrest |
| retention_limit | Maximum number of files maintained. Beyond this, the system automatically replaces the old files with the new backed up files. | 2 |
postgres:
path: /var/lib/pgbackrest/
retention_limit: 2Configure Artifacts Backup/Restore
The host specified in the inventory under bahmni-backup-artifacts will be used to take backup in that particular host.Only one host can be specified to take backup
[bahmni-backup-artifacts]
192.168.33.13Configurable parameters
Below are some of the configurable parameters
| Key | Description | Default Value |
|---|---|---|
| async_timing | restore and backup can be done asynchronously.This timing is the maximum runtime for which the job will run in background.value has to be specified in seconds. | 86400 |
| backup_to_path | path to store the backedup artifacts | /mymount |
| backup_from_path | path from where backup has to be taken | /home/bahmni/patient_images/home/bahmni/document_images/home/bahmni/uploaded-files/home/bahmni/uploaded_results/home/bahmni/pacs_images/home/bahmni/reports |
| restore_from_path | path from where backup files that has to be restored will be taken | /mymount |
| restore_to_path | path to restore artifacts | /home/bahmni/ |
| retention_limit | Maximum number of files maintained for each artifact. Beyond this, the system automatically replaces the old files with the new backed up files. | 2 |
patient_images:
backup_to_path: /mymount
backup_from_path: /home/bahmni/patient_images
restore_from_path: /mymount
restore_to_path: /home/bahmni/
retention_limit: 2Issues Fixed:
The issue mentioned here related to artifacts is fixed as part of release-0.89.
all_artifacts:
- name: patient_images
backup_to_path: /mymount
backup_from_path: /home/bahmni/patient_images
restore_from_path: /mymount
restore_to_path: /home/bahmni/
retention_limit: 2Bahmni Wiki · CC BY-SA 4.0