This article explains how to backup a local Postgres based IriusRisk database.
We will assume in this article, the name of the database you are using is iriusprod and the user is also iriusprod. If it is different, please change the occurences in the following scripts.
Also, another assumption is that you are using a Linux based system, this article is not covering Windows-based deployements of the database.
Backup process:
Login to the system with a user that has sudo privileges for the user postgres and execute:
$ sudo -u postgres /usr/bin/pg_dump iriusprod | gzip > /tmp/irius.$(date +%s).sql.gz
That will create the backup file with a Unix epoch date timestamp on it. You will need to move the file to a backup repository. And it is recommended to check the file has a reasonable size for a database backup (>1MB).
Recover process:
To recover an specific database backup (i.e. irius.1581934075.sql.gz) you will need to execute the following commands.
First of all make sure IriusRisk is stopped, if you are using the docker deployment:
$ docker-compose stop
Next execute the following comands:
$ gunzip irius.1581934075.sql.gz
$ sudo -u postgres /bin/bash -c 'echo "DROP DATABASE iriusprod; CREATE DATABASE iriusprod with owner=iriusprod" | /usr/bin/psql'
$ sudo -u postgres /usr/bin/psql iriusprod <irius.1581934075.sql
Comments
0 comments
Article is closed for comments.