Skip to content

You are viewing documentation for Immuta version 2020.2.

For the latest version, view our documentation for Immuta SaaS or the latest self-hosted version.

Single Node Docker Backups

Audience: System Administrators

Content Summary: The Immuta Single Node Docker installation contains a backup script that creates a backup archive that can be easily used to restore an Immuta installation. The backup script is packaged inside of the database Docker container allowing it to be executed using the docker exec functionality. By default backups are stored in ${IMMUTA_HOME}/volumes/db/backups on the host system, then mounted into the database Docker container at /var/lib/immuta/postgresql/backups by default to ${IMMUTA_HOME}/volumes/db/backups on your host system.

Ensure ${IMMUTA_HOME} is configured

Prior to executing any of the backup commands below, ensure your ${IMMUTA_HOME} environment variable is properly set.

env | grep 'IMMUTA_'

If not set, re-source your immuta-env file as detailed in Single Node Docker Install, Step 2.

One-time Backup

To take a one-time backup, execute the command below:

COMPOSE_INTERACTIVE_NO_CLI=1 /usr/local/bin/docker-compose --file "${IMMUTA_HOME}/docker-compose.yml" exec -T --user 1000 db

Recurring/Scheduled Backups

This section provides a sample backup script that can be used to exec into the database container, trigger a backup to occur, and then clean up any old backups. This script may be used to perform the backups either manually when run by an operator or scheduled to run automatically at some periodic interval using a tool like Cron.

Example Backup Script

Below is an example backup script that may be used in a Cron job to backup the Immuta database.


set -e


# Max number of backups to have. Any number of backups greater than or equal to this number will
# be removed. The number of backups that will exist will be BACKUP_THRESHOLD - 1.
# Example: if BACKUP_THRESHOLD=3, then only 2 backups will exist at a given time.

COMPOSE_INTERACTIVE_NO_CLI=1 /usr/local/bin/docker-compose --file "${IMMUTA_HOME}/docker-compose.yml" exec -T --user 1000 db
find "${BACKUPS_DIR}" -type f -name '*.tar.gz' | sort -r | tail -n +${BACKUP_THRESHOLD} | xargs rm -f

Be sure to make the script executable:

chmod +x

Scheduling Automatic Backups Using Cron

It is recommended to use Cron to run the backup job periodically. The Cron job must have access to the Docker engine, which typically means that it must run at root. You may add the entry in your preferred location, such as /etc/crontab or /etc/cron.d, or you may add it to the root user's configuration by running sudo crontab -e.

Below is an example crontab entry that runs the backup script every day at midnight.

0 0 * * * /opt/immuta/ > /opt/immuta/backup-immuta-task.log

Backups for Migration to an Immuta Kubernetes Helm Deployment

Migrating the Immuta Docker deployment to a Kubernetes Helm deployment can be done with the Docker backup file. The singular backup file consists of two databases: the Immuta Metadata database (bometadata) and the Immuta Query Engine database (immuta). The Immuta Metadata database and Immuta Query Engine database are separate components for the Immuta Kubernetes Helm deployment; however, the singular backup file can be used as the backup for both components. The file will need to be staged in an appropriate location for the Immuta Metadata and Immuta Query Engine databases.


cp volumes/immuta-db/backups/immuta-20210512103030.tar.gz <pvc or bucket>/database/immuta-20210512103030.tar.gz
cp volumes/immuta-db/backups/immuta-20210512103030.tar.gz <pvc or bucket>/query-engine/immuta-20210512103030.tar.gz

Once the backup is created, refer to the Import Backups Helm documentation for next steps.