Sunday, December 8, 2013

Alfresco Cold BackUp and Restore using In built postgres database



Alfresco Cold Backup
For the sake of this article here we are assuming that we are using alfresco 3.4.3 version with in-built postgresql server installed on linux machine.For taking cold back up of alfresco server, follow the below steps.
Step 1 ::Stop the Alfresco server from which you want to take the backup.
--> Go to {ALFRESCO_HOME} and run the command sh alfresco.sh stop or kill tomcat process manually.
Step 2 ::Now take copy of alf_data folder which is inside alfresco home folder.
Step 3 ::Now we need to take the dump from the postgres database .For that manually start the postgres server. For that use command
$pg_ctl start -D [Database location]
Example: pg_ctl start -D /opt/alf3.4.3/postgresql
-->Now go to location {ALFRESCO_HOME}/postgresql/bin and run the command
$./pg_dump -U [username] [Database Name] > output.backup
Now we have database dump in output.backup file and copy of alf_data.Lets restore dump on new alfresco server.
Restore the dump to other alfresco server
I am assuming that new fresh alfresco server is using inbuilt postgres database.For restoring the dump follow the below steps.
Step 1::First we need to drop the database of the new server.For that Go to location {ALFRESCO_HOME}/postgresql/bin and run the command
$./dropdb -U alfresco alfresco
Now we have dropped the database and we need to create a new database.
Step 2: Create a new database. For that do following steps.
-->execute the command on command prompt ::
$./psql
It will ask for password :: (Enter the password of default user postgres)
--> create database named alfresco :: run below commands.
#postgres > CREATE DATABASE alfresco WITH OWNER = alfresco TABLESPACE = pg_default
#postgres > \q (Quiting the postgres)
Step 3 :: Restoring the database from the dump file.For that go to location {ALFRESCO_HOME}/postgresql/bin and run the following command.
$./psql -U alfresco -f [backup file]
Step 4:: Copy all the contents alf_data except postgresql folder to alf_data.
Step 5 :: Restart the alfresco server.
The permission for postgresql folder under alf_data should be 700 and the owner of the folder should start the server.
Thats it !!!!!!!!!!we have restored the dump on new alfresco server.

No comments:

Post a Comment