This site is for Avast Business products only. For articles on AVG Business products, see AVG Business Help. If you are in the right place but cannot find what you are looking for, please contact Avast Business Support for further assistance.

Backing Up and Restoring On-Premise Console Database on Linux

This Article Applies to:

  • Avast Business On-Premise Console

 

This article describes the process for backing up and restoring your On-Premise Console database.

Backing Up

Before attempting to back up your On-Premise Console's database, make sure the database container is running using the docker-compose ps command.

If the container is not running, execute the docker-compose up command to start it.

Then, open a new terminal and call:

  • docker exec -t afb-db-1 pg_dumpall -c -U postgres > dump_file.sql
    • This assumes that the database is running in the container named afb-db-1
    • If prompted for a password, you will need the afb_db_password from the .env file for the docker instance
    • You can change the path if needed

This command will create a database dump file called dump_file.sql. The backup is the SQL file itself.

Restoring from Backup

Before attempting to restore your database from the backup file, make sure once again the database container is running using the docker-compose ps command.

Then, open a new terminal and call:

  • cat dump_file.sql | docker exec -i afb-db-1 psql -U postgres (if the docker host is on Windows, use type dump_file.sql | docker exec -i afb-db-1 psql -U postgres instead)
    • This assumes that the database is running in the container named afb-db-1
    • If prompted for a password, you will need the afb_db_password from the .env file for the docker instance

This command will restore the database from dump_file.sql, i.e. the backup you previously created.

Note that some changes are loaded only on the application startup, so you will need to restart the application (e.g. by calling docker-compose down and then docker-compose up).

After importing the database into the docker console, make sure that the afb_db_user, afb_db_passwrod, and afb_db_name in the .env file for the new docker instance match the entries in the old docker instance .env file.