cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco full backup ?

vpoorboy
Champ in-the-making
Champ in-the-making
Hi, I want to write a script that backup all of alfresco (content, category, group, user, …). alf_data dir and a Mysql dump are enough ?
10 REPLIES 10

heiko_robert
Star Collaborator
Star Collaborator
thats all you need to do.

e.g.:

export ALF_DATA_BASE=/opt/alfresco
export ALF_DATA_DIRNAME=alf_data
export BACKUP_DIR=/backup
export DB_USERNAME=alfresco
export DB_PWD=alfresco
export DB_NAME=alfresco130

cd $ALF_DATA_BASE/$ALF_DATA_DIRNAME
mysqldump -u$DB_USERNAME -p$DB_PWD $DB_NAME > $DB_NAME.sql
cd $ALF_DATA_BASE
tar cvfz $BACKUP_DIR/$ALF_DATA_DIRNAME.tgz $ALF_DATA_DIRNAME

regards
Heiko

vpoorboy
Champ in-the-making
Champ in-the-making
Thank you ! Will we need to stop the server ?

heiko_robert
Star Collaborator
Star Collaborator
yes and no. it depends since you can't garantee to create both in sync (alf_dir and db backup). The file backup like done in this script takes time and if somebody adds or deletes content you will get an inconsistent backup.
To get around that you need a storage system which is able to create snapshots (which garantees db and filebackup in sync) or you just shut down alfresco during backup.

regards
heiko

vpoorboy
Champ in-the-making
Champ in-the-making
Oh, thanks ! I think so.
Have u built import/export command line tool, there's a BAT script on windows to build the class path. Have you converted it to bash script on Linux ? Converting is not much difficult, but I'm not sure whether it's enough environments on Linux.

rdanner
Champ in-the-making
Champ in-the-making
Thank you ! Will we need to stop the server ?

As was said, it depends on how complete you need the backup to be.  Either you take the system off line and nothing can be added or you have to deal with the possibility that someone added data during the export.

If you need to do a hot backup:

In terms of the export capability of alfresco, I dont know how it handles this issue.  I suppose it starts a transaction and exports the system in that state.

If you backup from primatives,  export the database first. This will make sure your pointers all point to valid files.  Backup the file store second.  If you backup more files then you have pointers to, no biggie.  The pointers to those files will get captured on the next backup.

dmusser
Champ in-the-making
Champ in-the-making
Everyone

I've posted a backup/restore script at: http://unrestricted-cms.blogspot.com/

I combined what was said in this post, and also found something interesting.  It appears that the alf_data directory and alfresco db instance could be cross platform capable.  I was able to sucessfully backup from Linux and restore on Windows.  So my question here is will that be suppored :_)

Anyway check it out and if you have comments on the script please let me know it is not final yet and I'm looking to add some hooks to shutdown alfreso, and automating the creation of the database.

-D

unknown-user
Champ on-the-rise
Champ on-the-rise
thats all you need to do.

e.g.:

export ALF_DATA_BASE=/opt/alfresco
export ALF_DATA_DIRNAME=alf_data
export BACKUP_DIR=/backup
export DB_USERNAME=alfresco
export DB_PWD=alfresco
export DB_NAME=alfresco130

cd $ALF_DATA_BASE/$ALF_DATA_DIRNAME
mysqldump -u$DB_USERNAME -p$DB_PWD $DB_NAME > $DB_NAME.sql
cd $ALF_DATA_BASE
tar cvfz $BACKUP_DIR/$ALF_DATA_DIRNAME.tgz $ALF_DATA_DIRNAME

regards
Heiko

What do I need to change, to use this script in co-operation with an Oracle XE, instead of a MySQL database?

Maybe somebody has already done this before?!

Chris

xexiz
Champ in-the-making
Champ in-the-making
Still no news about a backup script with oracle DB instead of MySQL.. ?

claudio_martins
Champ in-the-making
Champ in-the-making
Have a look at Oracle Import/Export Utility @ Google.