cancel
Showing results for 
Search instead for 
Did you mean: 

How to backup up the default Postgresql Database?

ericevanz
Champ in-the-making
Champ in-the-making
Hi,

I used the bundled Linux installer to install Community 4.0a.  How do I backup the included Postgresql Database?  My attempts to at using the psql and postgres commands to login into SQL prompt me to install the PostgreSql package, but I know it's already running.
14 REPLIES 14

isra_vass
Champ on-the-rise
Champ on-the-rise
Well, i think that all you need to do is configure an scheduled backup of the database.

For windows, you can follow this:

http://wiki.postgresql.org/wiki/Automated_Backup_on_Windows

The fact, is that in windows you will need to have any tool to configure a scheduled task to do that, but should´t be difficult.

I  hope this helps,

Regards

Hi Isra,

Thank you for the tips to have a scheduled backup of the database. Really helps! Smiley Happy

Thanks~
JP

cibex
Champ in-the-making
Champ in-the-making
#1 stopping alfresco services
./opt/alfresco/alfresco.sh stop

#2 backup file system
tar czvf /opt/alfresco-bkp/alf_data_$(date +%Y%m%d-%H%M%S).tgz /opt/alfresco/alf_data

#3 backup alfresco database (postgres needs to be started)
# don´t mix up os user and postgres user, by default there is no alfresco os user

/opt/alfresco/postgresql/bin
su postgres ./pg_ctl start
su postgres -c './pg_dump -U alfresco alfresco | gzip > /opt/alfresco-bkp/postgres_$(date +%Y%m%d-%H%M%S).dmp.gz'
su postgres ./pg_ctl stop

#4 starting alfresco services
./opt/alfresco/alfresco.sh start


I found this article helpful to create a cron job: http://grover.open2space.com/content/postgresql-84-database-backups-pg_dump-and-cron


kr

Josef

gopei
Champ in-the-making
Champ in-the-making
Hi cibex,.. thanks for your command to create backup. but, this is step for backup.

how to step for restore after create backup step? thanks

gopei
Champ in-the-making
Champ in-the-making
after I used the bundled Linux installer to install Community 4.2.c ib ubuntu 12.04 OS server, to install Community on different server machines

the first one I did was:

1> compress all of the directory. (/opt/alfresco-4.2.c)

2> backup database with like this:
/opt/alfresco-4.2.c/postgresql/bin/pg_dump-U alfresco alfresco | gzip > /opt / postgres_ $ (date +% Y% m% d-% H% M% S). dmp.gz

then

1> rename old directory like this (/opt/alfresco-4.2.c with  /opt /alfresco_old)

2> extract it to a new server machine (/opt/alfresco-4.2.c)

3> and restore postgre database like this
      /opt/alfresco-4.2.c/postgresql/bin/psql-U alfresco alfresco </opt/postgres_20130904-093544.dmp.

  (note: all the processes that I did with alfresco conditions of service is not running).

However, it still does not run postgre database. sample in console :

root@dms1:~# /opt/alfresco-4.2.c/postgresql/scripts/ctl.sh status
postgresql not running

root@dms1:~# /opt/alfresco-4.2.c/postgresql/scripts/ctl.sh start
could not change directory to "/root"
waiting for server to start………………………………………………………pg_ctl.bin:
could not start server
Examine the log output.
/opt/alfresco-4.2.c/postgresql/scripts/ctl.sh : postgresql  could not be started


where lies the fault?
Can you help me? is there a step by step for an easier way to backup and restore of alfresco?

many thanks and best regards.
gopei