In the Alfresco wiki is described the backup and restore strategy but is not so clear how to do it in detail. In this post is shared a practical way to perform a restore of a backuped Alfresco in the way I like: a list of commands and tasks to execute… simpler to understand, to do and to test.
In this example is supposed that Alfresco is installed in ‘/opt/alfresco’ folder and the DBMS used is PostgreSQL. The restore strategy supposes that the backup is done as a “cold backup” described in this ‘Alfresco backup script‘ post.
First of all proceed to stop alfresco.
service alfresco stop
Supposing the DBMS runs using the ‘postgres’ user, proceed as first task to restore the PostgreSQL database.
su - postgres psql DROP DATABASE alfresco; CREATE DATABASE alfresco WITH OWNER alfresco;
Digit CTRL+d to exit from the shell.
psql -U alfresco -d alfresco ALTER USER alfresco WITH PASSWORD 'alfresco';
Digit CTRL+d to exit from the shell. Supposing the DBMS backup is stored in the ‘alfresco_postgres.tar’ file conforming to the backup strategy described here, let’s go ahead with the restoring of the database.
pg_restore -d alfresco alfresco_postgres.tar exit
Now it’s time to restore the ‘alf_data’ folder with documents and indexes. Also in this case is supposed that the files are stored in a ‘alfresco_data.tgz’ file conforming to the backup strategy described here.
cd /opt/alfresco mv alf_data alf_data.old tar zxvf alfresco_data.tgz
Now it’s time to start again Alfresco and use it normally.
service alfresco start