Options for Backing up DHIS2

Hi team,

I would like to know, what are backup options available for DHIS2 deployments with dhis2-tools?

Hello @Quoda
Please say more, But if you are talking about Backups when using dhis2-tools to deploy DHIS2, there are several backup options available to ensure data protection and disaster recovery. Here are some commonly used backup options for DHIS2 deployments with dhis2-tools:

  1. Database-level backups: This involves backing up the underlying database used by DHIS2, such as PostgreSQL or MySQL. You can use the native backup tools provided by the database management system to create regular backups of the database. For example, with PostgreSQL, you can use the pg_dump command to create a backup file.

  2. Filesystem backups: In addition to the database, it’s important to back up the DHIS2 data directory, which contains uploaded files, attachments, and resource files. You can schedule regular backups of this directory using filesystem-level backup tools or utilities like rsync to synchronize the data to another location.

  3. Docker volumes or Kubernetes persistent volumes: If you are using Docker or Kubernetes for your DHIS2 deployment, you can leverage the built-in volume management capabilities to create backups of the volumes associated with DHIS2. This ensures that both the database and data directory are backed up together.

  4. Automated backup scripts: You can create custom backup scripts that combine database and filesystem backups into a single process. These scripts can be scheduled using cron jobs or task schedulers to automate the backup process at regular intervals.

  5. Cloud storage backups: Consider utilizing cloud storage services, such as Amazon S3, Google Cloud Storage, or Azure Blob Storage, to store your backups securely in the cloud. You can configure your backup scripts to upload the backup files to the cloud storage provider.

  6. Offsite backups: It’s important to store backup files in an offsite location or a separate server to protect against data loss in case of server failures or disasters. You can use network file transfers or cloud storage services for offsite backup storage.

Remember to regularly test your backup and restore procedures to ensure they are working correctly. It’s also important to keep multiple copies of backups and implement a retention policy to manage the backup files effectively.

The choice of backup option depends on your specific deployment setup and infrastructure. It’s recommended to consult the dhis2-tools documentation and the documentation of your chosen database management system and backup tools for detailed instructions and best practices regarding backups.

There is a post we have just shared have a look at this link on this post - How do I backup and restore my DHIS2 Database instance - #2 by moses_mwale


Hi @moses_mwale,

Thanks so much for taking time to develop this breakdown of options for DHIS2 backup.
Exactly what I wanted to know! Very helpful.


@moses_mwale If I used the pg_dump command to create dump file of my db, and trying to inject the the dump file into a new instance, what I expect is to have dashboards, users, TEIs, etc from the previous instance working in the new instance. Am I right?

I tried this out; injecting the dump file into a new instance but I do not get my expected results. Is there something I should know? Thanks for your help