Вы находитесь на странице: 1из 26

White Paper

Alfresco Backup and Disaster


Recovery


ii

CopyrlghL 2014 by Alfresco and oLhers.
lnformaLlon ln Lhls documenL ls sub[ecL Lo change wlLhouL noLlce. no parL of Lhls documenL
may be reproduced or LransmlLLed ln any form or by any means, elecLronlc or mechanlcal, for
any purpose, wlLhouL Lhe express wrlLLen permlsslon of Alfresco. 1he Lrademarks, servlce
marks, logos, or oLher lnLellecLual properLy rlghLs of Alfresco and oLhers used ln Lhls
documenLaLlon ("1rademarks") are Lhe properLy of Alfresco and Lhelr respecLlve owners. 1he
furnlshlng of Lhls documenL does noL glve you llcense Lo Lhese paLenLs, Lrademarks, copyrlghLs,
or oLher lnLellecLual properLy excepL as expressly provlded ln any wrlLLen agreemenL from
Alfresco.
1he unlLed SLaLes exporL conLrol laws and regulaLlons, lncludlng Lhe LxporL AdmlnlsLraLlon
8egulaLlons of Lhe u.S. ueparLmenL of Commerce, and oLher appllcable laws and regulaLlons
apply Lo Lhls documenLaLlon whlch prohlblL Lhe exporL or re-exporL of conLenL, producLs,
servlces, and Lechnology Lo cerLaln counLrles and persons. ?ou agree Lo comply wlLh all exporL
laws, regulaLlons, and resLrlcLlons of Lhe unlLed SLaLes and any forelgn agency or auLhorlLy and
assume sole responslblllLy for any such unauLhorlzed exporLaLlon.
?ou may noL use Lhls documenLaLlon lf you are a compeLlLor of Alfresco, excepL wlLh Alfresco's
prlor wrlLLen consenL. ln addlLlon, you may noL use Lhe documenLaLlon for purposes of
evaluaLlng lLs funcLlonallLy or for any oLher compeLlLlve purposes.
1hls copyrlghL applles Lo Lhe currenL verslon of Lhe llcensed program.


iii
Document History

VERSION DATE AUTHOR DESCRIPTION OF CHANGE
0.1 11-Apr-13 Toni de la Fuente Initial version
0.2 16-Oct-13 Toni de la Fuente Added backup procedures
skeleton by David Almazan
0.3 30-Oct-13 Toni de la Fuente Final draft document
0.4 3-Nov-13 Toni de la Fuente Added Solr backup URLs
0.5 7-Jan-14 Toni de la Fuente Made some changes and
corrections after Mike Farman
review.





iv
Table of contents
INTRODUCTION ............................................................................................................................. 1
COSTS AND BUSINESS IMPACT ............................................................................................................. 1
BACKUPS METHODS ............................................................................................................................ 2
DISASTER RECOVERY ......................................................................................................................... 2
BACKUP OVERVIEW AND STRATEGY ......................................................................................... 5
SCHEDULING AN ALFRESCO BACKUP .................................................................................................... 5
Solr scheduled backup job ............................................................................................................................................. 5
Lucene scheduled backup job ........................................................................................................................................ 7
Other scheduled jobs to consider on a backup strategy ................................................................................................ 9
BACKUP PROCEDURE ................................................................................................................ 10
WHAT MUST BE BACKED UP ............................................................................................................... 10
STATIC DATA ................................................................................................................................... 10
DYNAMIC DATA ................................................................................................................................ 10
WHY IS ORDER IMPORTANT? ............................................................................................................. 11
COLD BACKUP ................................................................................................................................. 11
WARM BACKUP ................................................................................................................................ 12
HOT BACKUP ................................................................................................................................... 12
Backing up the Database ............................................................................................................................................. 13
RESTORE ...................................................................................................................................... 16
COLD BACKUP RESTORE ................................................................................................................... 16
HOT BACKUP RESTORE ..................................................................................................................... 16
Notes for Lucene restore .............................................................................................................................................. 17
SINGLE FILE RESTORATION ................................................................................................................ 17
RESTORING CONTENT FILES ............................................................................................................. 18
THIRD PARTY RESOURCES FOR ALFRESCO BACKUP AND DISASTER RECOVERY .......... 20


Alfresco Backup and Disaster Recovery

"#$%

Introduction
1o Lalk abouL backup ls Lo Lalk abouL buslness conLlnulLy. MulLlple Lypes of hazards can occur
whlle a sysLem ls operaLlng, hardware or sofLware fallures, daLa corrupLlon, naLural dlsasLers,
human errors, performance lssues, eLc. Also planned or unplanned lnLerrupLlons llke
malnLenance Lasks or upgrades musL be Laken lnLo accounL for buslness conLlnulLy.
Slnce Lhe proLecLlon, lnLegrlLy, prlvacy of conLenLs and Lhe buslness conLlnulLy of servlce maLLer
Lo Alfresco, we are aware of Lhe lmporLance of backup and recovery. 1hls documenL ls abouL
helplng you become famlllar wlLh Lhe maln componenLs of Alfresco ln order Lo develop a
backup and recovery sLraLegy for Alfresco LnLerprlse 4 and hlgher. lL ls wldely and lncorrecLly
LhoughL LhaL securlLy ls solely a Lask or a producL, buL when we Lalk abouL securlLy we are
speaklng abouL a conLlnuous process. 1herefore we musL also Lake lnLo conslderaLlon Lhe
SecurlLy lan of Lhe organlzaLlon, Lhe organlzaLlon's ConLlngency lan and Lhelr ulsasLer
8ecovery lan.
uependlng on Lhe parLlcular needs of each pro[ecL Lhe number of backed up componenLs may
vary ln Lerms of number of servers or locaLlons. 1hls documenL wlll cover all componenLs,
procedures and meLhodologles for all needed componenLs ln Alfresco ln order Lo be able Lo
backup and resLore any producLlon envlronmenL.
Costs and business impact
1o plan a backup and recovery process Lhe flrsL Lask Lo address ls Lo flgure ouL how much daLa
loss ls accepLable and how LhaL loses mlghL lmpacL our buslness.
1he Llme beLween backups ls called 8ecovery olnL Cb[ecLlve (8C) LhaL means Lhe maxlmum
amounL of daLa we can lose. Cn Lhe oLher hand Lhe Llme Laken Lo resLore Lhe appllcaLlon and
make lL avallable ls called 8ecovery 1lme Cb[ecLlve (81C). 8C has Lo be deflned by your
buslness. 81C depends on procedures and ablllLy Lo recover daLa and geL Lhe appllcaLlon back
onllne. 8oLh ob[ecLlves musL be based on Lhe flnanclal lmpacL Lo Lhe buslness when Lhe sysLem
ls unavallable. 1haL flnanclal facLor lncludes loss of buslness and repuLaLlon due Lo Lhe
downLlme and lack of sysLem avallablllLy.
Cnce 8C and 81C are known, you can calculaLe how ofLen you need Lo perform backups and
how long Lhe lnLervals should be beLween each backup process. lf a sysLem has Lo be avallable
24x7, Lhere ls no backup wlndow. ln Lhls case a hoL backup has Lo be performed.
1he LoLal amounL of sLorage Lo backup and number of coples Lo malnLaln has Lo be planned
before hand. 1he number of full and lncremenLal backups Lo keep musL be lncluded ln Lhe
backup pollcy as well.


Alfresco Backup and Disaster Recovery White Paper
2
Backups methods
1here are dlfferenL backup levels:
Iu|| backup: when we are dolng a compleLe copy of all of Lhe flles. 1hls backup Lends Lo
be slow and ls Lyplcally performed as flrsL backup or aL a regular lnLerval of Llme.
Incrementa|: when only Lhe changes from Lhe lasL backup are backed up. lasLer backup
Lhan cumulaLlve, could be slower Lo resLore Lhan cumulaLlve because Lhere could be
more flles Lo resLore.
Cumu|at|ve or D|fferent|a|: only copy changes afLer Lhe mosL recenL full backup. 1hls
meLhod may be slower Lhan lncremenLal buL ls usually fasLer Lo resLore.
1ypes of backup Lechnlques dependlng on Lhe sysLem avallablllLy:
Co|d: a compleLe backup of all componenLs of Alfresco wlLh Lhe enLlre sysLem shuL
down.
Warm: backup performed whlle some servlces of Alfresco are unavallable, l.e.: seL Lhe
reposlLory Lo read only mode.
not: backup performed whlle Lhe sysLem ls runnlng and poLenLlally belng used.
CLher concepLs Lo Lake lnLo accounL:
8ackup w|ndow: Llme Lo do lL. WlLh Alfresco lL depends on Lhe Lype of backup chosen.
8ackup rotat|on: Llme perlod whlle dolng lncremenLal backups beLween perlodlc and
full backups: dally, weekly or monLhly are mosL common.
8ackup dest|nat|on: neLwork devlce (nAS, Amazon S3, SC, l1, eLc.), SAn, dlsk Lo Lape,
dlsk Lo dlsk. Lach backup meLhod can be orlenLed for dlfferenL soluLlons and dependlng
on Lhe amounL of daLa Lo backup. lor dlsasLer recovery conslder uslng a remoLe backup
meLhod.
Disaster recovery
ulsasLer recovery ls Lhe process, pollcles and procedures relaLed Lo preparlng for recovery or
conLlnuaLlon of Lechnology lnfrasLrucLure, crlLlcal Lo Lhe organlzaLlon, afLer a naLural or human-
lnduced dlsasLer.
?ou can use several Lechnologles Lo proLecL appllcaLlon daLa, lncludlng reslllenL sLorage,
mlrrorlng and repllcaLlon. A server clusLer and dlsasLer recovery envlronmenL needs one or
more of Lhese Lechnologles.
1he dlsasLer recovery conflguraLlons musL conslder Lhe orlglnal deploymenLs or orlgln sysLems
and how Lo back Lhem up Lo a LargeL deploymenL. uependlng on Lhe servlce we wanL Lo provlde
from Lhe dlsasLer recovery envlronmenL, we can conslder Lhe nexL levels:
Alfresco Backup and Disaster Recovery

&#$%

D|saster recovery dep|oyment w|th fu|| capac|ty: backups and conflguraLlon are
repllcaLed Lo a LargeL deploymenL wlLh exlsLlng hardware and sofLware LhaL has Lhe
same capaclLy as Lhe orlglnal one.
D|saster recovery dep|oyment w|th reduced capac|ty: backups and conflguraLlon are
repllcaLed Lo a LargeL deploymenL wlLh exlsLlng hardware and sofLware buL wlLh less
capaclLy LhaL Lhe orlglnal one.
Data d|saster recovery on|y: 8ackups and conflguraLlon are repllcaLed wlLhouL
hardware or sofLware deployed.
1he A|fresco subscr|pt|on |nc|udes a stand-by d|saster recovery env|ronment. 1he
procedures and concepLs covered by Lhls gulde can be used Lo lmplemenL your d|saster
recovery plan as an asynchronous procedure.
A dlsasLer recovery plan and envlronmenL can be performed ln dlfferenL ways. As ln Lhe
dlagram below Lhe copy or repllcaLlon of Lhe conLenL sLorage and daLabase ls made by
vendor speclflc soluLlons.

vendor speclflc soluLlons for daLabase or sLorage repllcaLlon are ouL of Lhe scope of Lhls
gulde. Powever ma[or daLabase vendors provlde repllcaLlon soluLlons for Lhelr producLs:
ostgresq|: hLLp://wlkl.posLgresql.org/wlkl/SLreamlng_8epllcaLlon
MySL: hLLp://dev.mysql.com/doc/refman/3.3/en/repllcaLlon.hLml
Crac|e: hLLp://www.oracle.com/LechneLwork/daLabase/feaLures/daLa-
lnLegraLlon/lndex.hLml
Alfresco Backup and Disaster Recovery White Paper
4
Cn Lhe sLorage slde mosL of Lhe ma[or sLorage vendors have repllcaLlon soluLlons also for
CAS soluLlons
1
.

1
hLLp://www.xenlL.eu/alf2cas
2
hLLp://localhosL:8080/share/page/console/admln-console/appllcaLlon
Alfresco Backup and Disaster Recovery

'#$%

Backup overview and strategy
lL ls lmporLanL Lo keep a sLrlcL pollcy on backup and recovery procedure Lasks. WlLh Alfresco,
Lhe loglcal order Lo carry ouL a hoL backup ls Lhe lndexes (backlng up from Lhe auLomaLed back-
up copy), Lhen a backup of Lhe daLa base and flnally a backup of Lhe conLenL sLore and oLher
requlred folders such as: logs, conflguraLlon flles, audlL flles, eLc.
Ior a co|d backup the order |s not |mportant.
keep ln mlnd LhaL dependlng on Lhe klnd of lndex server Lhe auLomaLlc backup wlll be done by
defaulL aL 2AM for Lucene or 2AM and 4AM for Solr cores.
Conslder uslng flle sysLem snapshoLs for Lhe ConLenL SLore and snapshoL-llke backup for u8 Lo
reduce Lhe lock Llme and Lhe appllcaLlon avallablllLy.
1esLlng recovery ofLen as a prevenLlve measure. Add a checked Alfresco recovery procedure Lo
your conLlngency plan.
All Alfresco componenLs Lo backup:

Scheduling an Alfresco backup
llrsL Lake lnLo accounL 81C and 8C. Alfresco has a defaulL conflguraLlon for backup of lLs
lndexes. 1hese Lasks are done by scheduled [obs and depend on Lhe Lype of lndexes chosen:
Solr scheduled backup job
Llve SCL8 lndexes are locaLed ln Lhe followlng paLhs speclfled by Lhe properLy $[daLa.dlr.sLore}
$[dlr.rooL}/solr/workspace-SpacesSLore/conf/solrcore.properLles and $[dlr.rooL}/solr/archlve-
SpacesSLore/conf/solrcore.properLles
$[dlr.rooL}/solr/workspace/SpacesSLore/lndex
$[dlr.rooL}/solr/archlve/SpacesSLore/lndex
?ou can seL Lhe Solr backup uslng dlfferenL meLhods:
unless we are dolng a cold backup we musL copy Lhe Solr from lLs own backup. lLs backup
conflguraLlon ls already planned, Lhese are Lhe defaulL values LhaL can be modlfled by addlng
Lhem lnLo alfresco-global.properLles:
solr.backup.alfresco.cronLxpresslon=0 0 2 * * ?
solr.backup.archlve.cronLxpresslon=0 0 4 * * ?
Physical Storage
Relational Database File System Lucene or SOLR
Installation,
Config and logs
Alfresco Backup and Disaster Recovery White Paper
6
solr.backup.alfresco.remoLe8ackupLocaLlon=$[dlr.rooL}/solr8ackup/alfresco
solr.backup.archlve.remoLe8ackupLocaLlon=$[dlr.rooL}/solr8ackup/archlve
solr.backup.alfresco.number1okeep=3
solr.backup.archlve.number1okeep=3
ConflguraLlon above means LhaL Lhe Alfresco core (workspace://SpacesSLore) ls done every day
aL 2:00AM creaLlng lLs flles ln $[dlr.rooL}/solr8ackup/alfresco. 1he Alfresco archlve core
(archlve://SpacesSLore) ls done every day aL 4:00AM. ln boLh cases 3 coples of Lhe lasL 3
backups are kepL. lnformaLlon sLored ln Lhose folders are whaL we have Lo copy Lo our backup
LargeL. lf we have a backup sLraLegy we may only need Lo keep one backup and also make Lhe
backup ln a dlfferenL perlodlclLy.
Using the Alfresco Admin Console
ln order Lo change Lhe backup properLles uslng Lhe AdmlnlsLraLlon Console" (prlor Lo 4.2 Lhru
Share
2
and Lhe Admln Console
3
ln 4.2 and laLer) you wlll need Lo enLer Lhe AdmlnlsLraLlon
Console". Cllck on Lhe Search Servlce":
?ou can Lhen speclfy Lhe backup locaLlon and how ofLen Lhe backups occur.

Using the JMX Client to manually force or create the Solr backup
WlLh a !Mx cllenL llke [console:
lor Alfresco Solr core:

2
hLLp://localhosL:8080/share/page/console/admln-console/appllcaLlon
3
hLLp://localhosL:8080/alfresco/servlce/enLerprlse/admln/admln-searchservlce

Alfresco Backup and Disaster Recovery

(#$%

!Mx M8eans > Alfresco > Schedule > uLlAuL1 > MonlLoredCron1rlgger >
search.alfrescoCore8ackup1rlgger > CperaLlons > execuLenow()
lor Archlve Solr core:
!Mx M8eans > Alfresco > Schedule > uLlAuL1 > MonlLoredCron1rlgger >
search.archlveCore8ackup1rlgger > CperaLlons > execuLenow()
?ou can check Lhe Solr backups on Lhe flle sysLem. 1hese wlll conLaln Lhe daLe appended Lo Lhe
folder name for easy reference:

Using the Solr admin panel to manually force or create the Solr backup
SCL8 can also be backed up dlrecL uslng nexL u8Ls:
lor Lhe alfresco core and only keep 1 backup:
hLLps://localhosL:8443/solr/alfresco/repllcaLlon?command=backup&locaLlon=/opL/alfresco/alf
_daLa/solr8ackup/alfresco&number1okeep=1
lor Lhe archlve core and only keep 1 backup:
hLLps://localhosL:8443/solr/archlve/repllcaLlon?command=backup&locaLlon=/opL/alfresco/alf_
daLa/solr8ackup/archlve&number1okeep=1
In order to do the backup from the command line, you may use curl and run it like this (see
comment about pem cert below):
curl -k --cerL /opL/alfresco/alf_daLa/keysLore/browser.pem:alfresco
hLLps://localhosL:8443/solr/alfresco/repllcaLlon?command=backup&locaLlon=/opL/alfr
esco/alf_daLa/solr8ackup/alfresco&number1okeep=1"
curl -k --cerL /opL/alfresco/alf_daLa/keysLore/browser.pem:alfresco
hLLps://localhosL:8443/solr/archlve/repllcaLlon?command=backup&locaLlon=/opL/alfre
sco/alf_daLa/solr8ackup/archlve&number1okeep=1"
Please, note that curl does not support p12 certificates therefore you need to convert the
default browser.p12 to browser.pem by running (password is alfresco):
openssl pkcs12 -ln /opL/alfresco/alf_daLa/keysLore/browser.p12 -ouL
/opL/alfresco/alf_daLa/keysLore/browser.pem -nodes
Alfresco Backup and Disaster Recovery White Paper
8
Lucene scheduled backup job
Lucene lndexes are locaLed ln Lhe followlng paLhs:
$[dlr.rooL}/lucene-lndexes
?ou can seL Lhe Lucene backup uslng dlfferenL meLhods:
unless we are dolng a cold backup we musL copy Lhe Lucene backup, whose backup
conflguraLlon already ls scheduled. 1hese are Lhe defaulL values LhaL can be modlfled by addlng
Lhem lnLo alfresco-global.properLles:
lndex.backup.cronLxpresslon=0 0 3 * * ?
dlr.lndexes.backup=$[dlr.rooL}/backup-lucene-lndexes
ConflguraLlon above means LhaL Lhe whole Lucene lndex backup ls done every day aL 3:00AM
creaLlng lLs flles ln $[dlr.rooL}/backup-lucene-lndexes. unllke Lhe Solr backup, only one backup
ls kepL. lnformaLlon sLored ln Lhls folder ls whaL we have Lo copy Lo our backup LargeL.
Using the Alfresco Admin Console
ln order Lo change Lhe backup properLles uslng AdmlnlsLraLlon Console" (prlor Lo 4.2 Lhru
Share
4
and Lhe Admln Console
3
ln 4.2 and laLer), you wlll need Lo enLer Lhe AdmlnlsLraLlon
Console". Cllck on Lhe Search Servlce":
?ou can Lhen speclfy Lhe backup locaLlon and how ofLen Lhe backups occur.

Using the JMX Client to manually force or create the Lucene backup
WlLh a !Mx cllenL llke [console:
lor Lucene:
!Mx M8eans > Alfresco > Schedule > uLlAuL1 > MonlLoredCron1rlgger >
lndex8ackup1rlgger > CperaLlons > execuLenow()

A rellable way Lo know lf Lhe Lucene lndex backup has flnlshed for Lhe day ls Lo check Lhe
subdlrecLorles of $[dlr.rooL}/backup-lucene-lndexes for Lhelr LlmesLamp. 1hls folder should
conLaln Lhe followlng sub-dlrecLorles:

4
hLLp://localhosL:8080/share/page/console/admln-console/appllcaLlon
3
hLLp://localhosL:8080/alfresco/servlce/enLerprlse/admln/admln-searchservlce
Alfresco Backup and Disaster Recovery

)#$%

Archlve
Locks
SysLem
user
Workspace
uurlng Lhe lndex backup, Lhese sub-dlrecLorles wlll be deleLed. 1hese dlrecLorles are noL
creaLed unLll Lhe lndex backup ls compleLely flnlshed. Make sure Lhe LlmesLamp on Lhe backup
sub-dlrecLorles show Llme values laLer Lhan Lhe lasL backup compleLed.
Other scheduled jobs to consider on a backup strategy
An orphan node ls a node LhaL has been cleaned from Lhe Lrashcan. AfLer 14 days as an orphan
(wlLhouL any meLadaLa on Lhe u8) Lhe ConLenL SLore Cleaner [ob sends all orphan nodes Lo
$[dlr.rooL}/conLenLsLore.deleLed. 1hls process runs every day aL 4:00AM and can be modlfled
by:
sysLem.conLenL.orphanCleanup.cronLxpresslon=0 0 4 * * ?
To prevent waiting 14 days until an orphan node is sent to ${dir.root}/contentstore.deleted you
can modify:
sysLem.conLenL.orphanroLecLuays=xx
1he deleLed conLenL sLore folder musL be deleLed manually. Alfresco keeps all flles Lhere and lL
never deleLes or cleans LhaL folder.
?ou can declde lf conLenL should be removed from Lhe sysLem lmmedlaLely afLer belng
orphaned (cleaned from Lhe Lrashcan) by seLLlng Lhls opLlon Lo Lrue:
sysLem.conLenL.eagerCrphanCleanup=false

Alfresco Backup and Disaster Recovery White Paper
10
Backup procedure
What must be backed up
1hls secLlon descrlbe Lhe overall concepL of 8ackup and 8esLore" of an Alfresco 8eposlLory.
1here are Lwo Lypes of daLa LhaL need Lo be consldered, sLaLlc and dynamlc.
Stat|c Data: lncludes sofLware componenLs LhaL do noL change Lhrough Lhe usage of Lhe
alfresco reposlLory.
Dynam|c Data: ls daLa LhaL changes as a resulL of uslng Alfresco.
Static Data
CperaLlng SysLem (noL covered by Lhls procedure).
App||cat|on Server Insta|| and conf|gurat|on f||es.
uaLabase lnsLallaLlon flles (lf lL ls ln same server, noL recommendable).
A|fresco extens|ons (custom|zat|ons)*.
3
rd
arLy appllcaLlons used by Alfresco (Cpen Cfflce, lmageMaglck, SWl1ools).

*A11LN1ICN: ay speclal aLLenLlon Lo your cusLomlzaLlons (such as AMs, [ar flles or any oLher
cusLom flle LhaL may be ln Lhe exLenslon dlrecLory). Add Lhem Lo your backup procedure
because LhaL wlll save you Llme when performlng a recovery.
Dynamic Data
Alfresco lndexes (Solr or Lucene)
uaLabase (8u8MS daLa flles, Lable spaces, archlve logs and conLrol flles).
Alfresco ConLenL SLores - Lhe defaulL and any oLher addlLlonal sLore used by ConLenL
SLore SelecLor. ConLenL SLore ueleLed ls noL requlred.
lor purposes of Lhls documenL, we wlll focus on Lhe backup and resLore procedure of Lhe
dynamlc daLa of Alfresco. lease conslder maklng a backup of Lhe sLaLlc daLa for qulck and easy
recovery.
6

1hese are shown ln Lhe followlng dlagram:


6
All daLa backup lncludlng sLaLlc daLa ls covered by Alfresco 8ackup and 8ecovery 1ool ln
hLLp://blyx.com/alfresco-barL *noL supporLed by Alfresco SupporL Servlces
Alfresco Backup and Disaster Recovery

""#$%


Why is order important?
uurlng Lhe backup process of an Alfresco SysLem Lhe followlng order should be Laken lnLo
accounL:
lndexes should be backed up flrsL. lf new rows are added ln Lhe daLabase afLer Lhe
Lucene/SCL8 backup ls done, lL's sLlll posslble Lo regeneraLe Lhe mlsslng Lucene/SCL8
lndexes from Lhe SCL LransacLlon daLa.
uaLabase backup should be performed nexL. lf you have a SCL node polnLlng Lo a
mlsslng flle, LhaL node wlll be an orphan. lf you have a flle wlLhouL a SCL node daLa, LhaL
flle wlll noL be lncluded ln Lhe backup.
Cold Backup
1hls ls Lhe slmplesL and safesL form of backup, slnce we do noL have Lo deal wlLh updaLes whlle
Lhe backup ls Laklng place.
Pere are Lhe necessary sLeps Lo perform a cold backup of Lhe sysLem. 1he order from 2 Lo 4 ls
noL lmporLanL:
1. SLop Lhe whole Alfresco sysLem (appllcaLlon server or all clusLer servers lf appllcable).
2. 8ackup Lucene or SCL8.
3. 8ackup Lhe Alfresco u8.
4. 8ackup Lhe ConLenL SLore, and any oLher ConLenL SLore lf appllcable.
3. Conslder backup of all your sLaLlc, lnsLallaLlon and cusLomlzaLlon flles.
6. SLarL Alfresco.
ConLenL SLore use Lo be locaLed ln $[dlr.rooL}/conLenLsLore or any oLher paLh glven by Lhe
properLy $[dlr.conLenLsLore} ln alfresco-global.properLles.
8y defaulL, Lhe $[dlr.rooL} conLalns boLh Lhe conLenL and lndexes. 8elng server sLopped a copy
of Lhe flles are enough as backup (noL Lhe lndex backup lLself).
Alfresco Backup and Disaster Recovery White Paper
12
lL ls posslble Lo backup [usL Lhe conLenL and do a full relndex when a backup of Lhe ConLenL
SLore and u8 ls resLored (for boLh Lucene and Solr). As sald before, noLe LhaL you can also
separaLe conLenL and lndexes lnLo dlfferenL dlrecLorles and noL necessary lnslde $[dlr.rooL}
(LhaL use Lo be alf_daLa).
ln a cold backup you musL nexL copy Lhe defaulL dlrecLorles:
ConLenLsLore:
$[dlr.rooL}/conLenLsLore
lndex lf Lucene:
$[dlr.rooL}/lucene-lndexes
lndexes lf Solr
$[dlr.rooL}/solr/workspace/SpacesSLore/lndex
$[dlr.rooL}/solr/archlve/SpacesSLore/lndex

Weakness of Lhls procedure ls LhaL users cannoL use Lhe appllcaLlon whlle Lhe backup ls Laklng
place. 1hls procedure musL be done when users or appllcaLlons don'L need access Lo Alfresco.
nlghL hours belng Lhe mosL common Llme frame for dolng Lhls procedure.
AdvanLage of Lhls procedure ls Lhe rellablllLy and conslsLency of Lhe backup daLa. no locks and
dlfferences beLween any daLa group (lndexes, u8 and ConLenL SLore) should be found.
Warm Backup
lor a manual backup, Lhe Alfresco sysLem admlnlsLraLor has an opLlonal workaround Lo
perform a cold backup wlLhouL sLopplng Alfresco server buL seLLlng lL up as read only and
forclng Lhe lndex backup before copylng.
WlLh a !Mx cllenL llke [console:
!Mx: Alfresco > ConflguraLlon > sysAdmln > defaulL > ALLrlbuLes > server.allowWrlLe=false
Cnce Lhe sysLem ls ln 8ead Cnly mode you can proceed dolng Lhe backup as ln Lhe PoL 8ackup
procedure. Cnce Lhe backup ls done seL Lhe properLy back before: server.allowWrlLe=Lrue
1he advanLage of Lhls procedure ls LhaL appllcaLlons and users can sLlll consume conLenL from Alfresco
buL wlLhouL wrlLlng prlvlleges.
Hot Backup
ln an Alfresco sysLem, Lhe ablllLy Lo supporL hoL backup ls dependenL on Lhe hoL backup
capablllLles of Lhe daLabase producL Alfresco ls conflgured Lo use.
uaLabase hoL backup requlres a Lool LhaL can "snapshoL" a conslsLenL verslon of Lhe Alfresco
daLabase. 1haL ls, lL musL capLure a LransacLlonally conslsLenL copy of all Lhe Lables ln Lhe
Alfresco daLabase. ln addlLlon, Lo avold serlous performance problems ln Lhe runnlng Alfresco
Alfresco Backup and Disaster Recovery

"&#$%

sysLem whlle Lhe backup ls ln progress, Lhls "snapshoL" operaLlon should elLher operaLe wlLhouL
ouL locklng Lhe Alfresco daLabase or lL should compleLe qulckly (wlLhln seconds).
8ackup capablllLles vary wldely beLween relaLlonal daLabase producLs, and you should ensure
LhaL any backup procedures LhaL are lnsLlLuLed are valldaLed by a quallfled, experlenced
daLabase admlnlsLraLor before belng puL lnLo a producLlon envlronmenL.
ln order Lo successfully perform a hoL backup you should follow Lhese sLeps ln order:
1. Conslder backlng up all your sLaLlc, lnsLallaLlon and cusLomlzaLlon flles.
2. Make sure you have Lhe lndex backup sLored:
a. 8elng $[dlr.rooL}/backup-lucene-lndexes lf Lucene ls used
b. Cr $[dlr.rooL}/solr8ackup/alfresco and $[dlr.rooL}/solr8ackup/archlve for Solr
3. Make sure LhaL any [ob LhaL generaLes lndex backup ls noL runnlng whlle performlng Lhe
daLabase backup. See schedule backup secLlon.
4. 8ackup Lhe daLabase Alfresco ls conflgured Lo use, uslng Lhe daLabase backup Lools (see
below 8acklng up Lhe uaLabase secLlon).
3. 8ackup speclflc subdlrecLorles ln Lhe Alfresco dlr.rooL.
a. $[dlr.rooL}/conLenLsLore
b. $[dlr.rooL}/cachedconLenL lf appllcable
c. Any oLher conLenL sLore
Backing up the Database
1he ablllLy Lo supporL a hoL backup ls dependenL on Lhe hoL backup capablllLles of Lhe daLabase
producL. 1hese are some of Lhe requlremenL for a conslsLenL hoL backup:
lL needs a Lool LhaL can snapshoL" a conslsLenL verslon of Lhe daLabase (lL musL capLure
a LransacLlonally conslsLenL copy of all Lables).
1he snapshoL" operaLlon should elLher operaLe wlLhouL locklng Lhe daLabase, or
compleLe exLremely qulckly.
?ou should ensure LhaL any backup procedure of Lhe daLabase ls valldaLed before
puLLlng lL lnLo a producLlon envlronmenL.

Considerations for MySQL
As a recommendaLlon, ln order Lo backup MySCL, you may use Lhe followlng sample command
belng server=localhosL, user=alfresco, password=alfresco, db name=alfresco:
mysqldump --slngle-LransacLlon -h localhosL -u alfresco -palfresco alfresco > alfresco.sql
1he opLlon --slngle-LransacLlon" creaLes a conslsLenL snapshoL by dumplng all Lables ln a
slngle LransacLlon. Whlle a --slngle-LransacLlon dump ls ln process, Lo ensure a valld dump flle
(correcL Lable conLenLs and blnary log poslLlon), no oLher connecLlon should use Lhe followlng
Alfresco Backup and Disaster Recovery White Paper
14
sLaLemenLs: AL1L8 1A8LL, u8C 1A8LL, 8LnAML 1A8LL, 18unCA1L 1A8LL, as conslsLenL
snapshoL ls noL lsolaLed from Lhem. CpLlon auLomaLlcally Lurns off --lock-Lables. ln Lhls case lL
wlll guaranLee a conslsLenL uaLabase backup.
1he command above wlll generaLe Lhe flle alfresco.sql", whlch conLalns a dump of Lhe Lables.
1hese flles are readable uslng a LexL edlLor, so spoLLlng corrupLlon becomes easler. Copy LhaL
flle Lo a safe place.
There are third party applications for MySQL backup
7
.
Considerations for PostgreSQL
uefaulL osLgreSCL Lools llke pg_dump are loglcal and do noL produce flle-sysLem-level
backups. 1o creaLe lncremenLal olnL-ln-1lme 8ecovery (l18) and flle-sysLem-level backups of
osLgresql please refer Lo WAL
8
.
lor a sLandard command Lo geL a dump of Lhe exlsLlng alfresco daLabase:
pg_dump --hosL=localhosL --username=alfresco --flle=alfresco.dump alfresco -w

There are third party applications for PostgreSQL backup
9
.
Considerations for Oracle
lor Cracle Lhere exlsLs a varleLy of Lools Lo perform backups. MosL commonly used are
exp/lmp, uaLapump and 8MAn.
Cracle's exporL (exp)
10
and lmporL (lmp) uLlllLles are used Lo perform loglcal daLabase backup
and recovery. When exporLlng, daLabase ob[ecLs are dumped Lo a blnary flle. 1he exporL/lmporL
uLlllLles are commonly used Lo perform backup and recovery buL only for small daLabases, say <
+30C8. lor larger daLabases use 8MAn lnsLead. Lxp/lmp also ellmlnaLes daLabase
fragmenLaLlon (exporL, drop and re-lmporL Lables) and deLecL daLabase corrupLlon.
uaLapump
11
ls a server based bulk daLa movemenL lnfrasLrucLure LhaL supersedes Lhe old
lmporL and exporL uLlllLles. 1he old exporL/ lmporL Lools are sLlll avallable, buL do noL supporL all
Cracle 10g and 11g feaLures. 1he new uLlllLles are named expdp and lmpdp.

7
hLLp://www.percona.com/sofLware/percona-xLrabackup
8
hLLp://www.posLgresql.org/docs/9.1/sLaLlc/conLlnuous-archlvlng.hLml
9
hLLp://www.pgbarman.org/
10
hLLp://www.orafaq.com/wlkl/lmporL_LxporL_lAC
11
hLLp://www.orafaq.com/wlkl/uaLapump
Alfresco Backup and Disaster Recovery

"'#$%

8MAn
12
8ecovery Manager (8MAn) ls an Cracle provlded uLlllLy for backlng-up, resLorlng and
recoverlng Cracle uaLabases. 8MAn shlps wlLh Lhe Cracle daLabase and doesn'L requlre a
separaLe lnsLallaLlon.

12
hLLp://www.orafaq.com/wlkl/8ecovery_Manager
Alfresco Backup and Disaster Recovery White Paper
16
Restore
1he resLore procedure depends on Lhe requlremenLs and Lools used Lo make Lhe backup. Also
all paLhs requlred Lo recover a backup are relaLed Lo your conflguraLlon as sald before. 1hls ls
why dolng backup of your conflguraLlon and cusLomlzaLlons are also mandaLory.
8emember LhaL Llme Laken Lo resLore Lhe appllcaLlon and make lL avallable agaln ls called
8ecovery 1lme Cb[ecLlve (81C).
Cold backup restore
Cnce we have all componenLs (sLaLlc and dynamlc) you can proceed Lo resLore all seLs.
NC1L: 1o ensure Lhe resLore works properly and Lo avold scrlpLs and conflguraLlon Lry Lo
respecL same paLh as you had before.
1. 8e sure all Alfresco relaLed servlces are sLopped (excepL daLabase because you wlll need
Lo geL access Lo lL ln order Lo recover Lhe backup.)
2. 8esLore lnsLallaLlon and cusLomlzaLlons. lf you don'L have a copy of your lnsLallaLlon do
a clean lnsLallaLlon and Lhen resLore all dynamlc componenLs. ?ou should have a backup
of your cusLomlzaLlons and apply Lhem before conLlnulng. lf your are uslng Solr and SSL
do a backup of your $[dlr.rooL}/keysLore.
3. Copy Lhe exlsLlng copy of your lndexes Lo Lhe new lndex folder (or same paLh as before.)
8emember LhaL dolng a resLore from a cold backup you can copy Lhe exlsLlng lndexes
lnsLead of Lhe backed up one.
4. 8ased on your daLabase vendor resLore Lhe daLabase backup followlng Lhelr
lnsLrucLlons.
3. Copy Lhe exlsLlng ConLenL SLore backup lnLo Lhe proper dlrecLory based on your
alfresco-global.properLles conflguraLlon.
6. SLarL Alfresco and LesL.

Hot backup restore
1he procedure Lo resLore a hoL backup flles ls preLLy slmllar Lo cold backup resLoraLlon buL wlLh
Lhe dlfference on Lhe lndexes. Cnce we have all componenLs (sLaLlc and dynamlc) you can
proceed Lo resLore all seLs.
1. 8e sure all Alfresco relaLed servlces are sLopped (excepL daLabase because you wlll need
Lo geL access Lo lL ln order Lo recover Lhe backup.)
2. 8esLore lnsLallaLlon and cusLomlzaLlons. lf you don'L have a copy of your lnsLallaLlon do
a clean lnsLallaLlon and Lhen resLore all dynamlc componenLs. ?ou should have a backup
of your cusLomlzaLlons and apply Lhem before conLlnulng. lf your are uslng Solr and SSL
do a backup of your $[dlr.rooL}/keysLore.
3. Copy Lhe backup lndexes (Lucene or Solr) Lo Lhe orlglnal lndex folder, remember Lo copy
Lhe exlsLlng backup as ls and ln Lhe same folder as llve lndexes (noL backup folders).
neverLheless lf no lndexes are found Alfresco wlll Lry Lo do a full lndex (Lhls depends on
Alfresco Backup and Disaster Recovery

"(#$%

your lndex conflguraLlon.) lf you have old flles on Lhe exlsLlng lndexes folder remove
Lhem or copy Lhem Lo a Lemporary place.
4. 8ased on your daLabase vendor resLore Lhe daLabase backup followlng Lhelr
lnsLrucLlons. MosL of cases you should have an empLy daLabase before resLorlng a
backup.
3. Copy Lhe exlsLlng ConLenL SLore backup lnLo Lhe proper dlrecLory based on your
alfresco-global.properLles conflguraLlon. lf you have old flles on Lhe exlsLlng conLenL
sLore folder remove Lhem or copy Lhem Lo a Lemporary place.

NC1L: 1o ensure Lhe resLore works properly and Lo avold scrlpLs and conflguraLlon Lry Lo
respecL same paLh as you had before.
Notes for Lucene restore
Alfresco wlll (by defaulL) deLecL LhaL Lhe lndexes are sLale, and lncremenLally relndex [usL LhaL
conLenL LhaL has changed slnce Lhe lasL backup was performed. As Lhe slze of your conLenL seL
grows, Lhe Llme savlngs from performlng lncremenLal relndexlng raLher Lhan full relndexlng wlll
become greaLer and greaLer (lncremenLal relndexlng ls Lyplcally measured ln mlnuLes, whereas
full relndexlng can Lake hours or days for large conLenL seLs.) ln such a case make sure LhaL
lndex.recovery.mode" ls seL Lo Au1C ln alfresco-global.properLles".
noLe LhaL ln addlLlon Lo full resLoraLlons, Lhe backup seLs creaLed vla elLher Lhe cold or hoL
backup procedures descrlbed above can also be used Lo resLore [usL Lhe Lucene lndexes. 1hls ls
useful ln cases where Lhe reposlLory lLself does noL need Lo be resLored buL for some reason
Lhe Lucene lndexes are sLale and rebulldlng Lhem from scraLch ls undeslrable.
Single file restoration
Cne of Lhe mosL demanded feaLures of backup and Alfresco ls Lhe selecLlve resLoraLlon of
conLenL. 1hls can be posslble by defaulL lf we know how Alfresco works when conLenL ls
deleLed.
Alfresco has a Lrashcan LhaL can be manage by Lhe admlnlsLraLor and slnce verslon 4.2 users
also can have access lnLo lL (see screenshoL below.) 1rashcan can be found ln Lhe My roflle"
secLlon Lhen 1rashcan."
When a node ls deleLed ln Alfresco by a user, Lhls conLenL wlll remaln ln Lhe Lrashcan forever
unless Lhe user or Lhe admlnlsLraLor clean Lhe Lrashcan. lf Lhe Lrashcan ls cleaned by Lhe user or
admlnlsLraLor, conLenL are marked as orphans and afLer 14 days Lhe conLenL ls moved Lo
conLenLsLore.deleLed. (See secLlon CLher scheduled [obs Lo conslder on a backup sLraLegy" for
more deLalls).
knowlng Lhls allows Lhe end user or Lhe admlnlsLraLor Lo perform slngle flle resLoraLlons. 1hls
may be posslble dependlng on Lhe company pollcy and malnLenance of deleLed flles.
Alfresco Backup and Disaster Recovery White Paper
18
lf slngle flle resLoraLlon ls requlred and Lhe flle ls no longer ln Lhe Lrashcan you have Lo resLore
an Alfresco lnsLallaLlon and Lhen resLore Lhe slngle flle from LhaL resLore.

Restoring Content Files
lf some lnconslsLences exlsL beLween your daLabase and your conLenL sLore, ln some cases lL
may be necessary Lo resLore a conLenL flle from an ob[ecL LhaL exlsLs ln Lhe daLabase buL no
longer ln Lhe conLenL sLore flle sysLem. 1hls ls a Lyplcal error recelved when Lhe conLenL ls noL
avallable.

CeLLlng Lhe conLenL from a backup and uslng Lhe node 8rowser" can flx Lhls. ?ou can vlew Lhe
node 8rowser" Lo check Lhe lnLernal properLles for an ob[ecL, lncludlng Lhe paLh ln Lhe conLenL
sLore.
1. ?ou wlll need Lo locaLe Lhe sLore paLh from Lhe documenL dolng a node8ef" search ln
Lhe node 8rowser". ln Lhe example above workspace://SpacesSLore/36e3e126-86ea-
46d9-8ffdc380c4e0d0ca"
Alfresco Backup and Disaster Recovery

")#$%


2. ?ou wlll Lhen need Lo locaLe Lhe flle ln Lhe backup of Lhe conLenL sLore.

3. ?ou wlll Lhen need Lo copy Lhe locaLed flle lnLo Lhe rlghL folder ln Lhe conLenL sLore flle
sysLem.


Alfresco Backup and Disaster Recovery White Paper
20
Third party resources for Alfresco backup and disaster
recovery
As an example, scrlpLlng for boLh Llnux and Wlndows can be done for backups.
Sample scrlpL based on 8obocopy
13
for Alfresco lnsLalled on Wlndows wlLh MySCL (lL doesn'L
lnclude Lhe lndex backup copy):
REM ************************ Backup ******************************
REM Backup a mySQL Alfresco instance
REM This script expects a standard, standalone installation
REM You should change the paths to reflect the specifics of your installation
REM
REM You should shutdown your Alfresco Server but leave mySQL running when executing
this script
REM

@echo off
@echo Copy shared extensions to .\backup\shared\classes\alfresco
robocopy .\tomcat\shared\classes\alfresco .\backup\shared\classes\alfresco /E /MIR
/log:.\backup\shared-alfresco-extensions-backup.log

@echo Copy shared lib to .\backup\shared\lib
robocopy .\tomcat\shared\lib .\backup\shared\lib /E /MIR /log:.\backup\shared-lib-
backup.log

@echo Dumping alfresco MySQL database to .\backup\alf_data\alfresco.dmp
mysql_x64\bin\mysqldump -u alfresco --password=alfresco alfresco >
.\alf_data\alfresco.sql
@echo Backing up .\alf_data
title Backing up .\alf_data
robocopy .\alf_data .\backup\alf_data /E /MIR /log:.\backup\alf_data-backup.log

REM Now copy .\backup somewhere else!


REM ************************ TODO Restore ******************************
REM Copy alf_data to where it should be
REM Create the empty Alfresco DB
REM import the DB using the following
REM mysql_x64\bin\mysql -u alfresco --password=alfresco < alfresco.sql

13
hLLp://en.wlklpedla.org/wlkl/8obocopy
Alfresco Backup and Disaster Recovery

$"#$%


Sample scrlpL for cold backup on Llnux wlLh MySCL:
#!/bin/bash

Days=`date +%Y%m%d-%H%M%S`;
Alfresco_root="/opt/alfresco";
Alfresco_repository="$Alfresco_root/alfresco_repository/";
Alfresco_indexes="$Alfresco_root/alfresco_indexes/";
Alfresco_backup_dir="/opt/Alfresco_Backup_$Days";
user_mysql="alfresco";
user_password="alfresco";
alfresco_db="alfresco";

echo "=== Stoping Alfresco ==="
echo $Alfresco_root/alfresco.sh stop
echo sleep 10;
echo "=== Making the directory backup $Alfresco_backup_dir ==="
echo mkdir $Alfresco_backup_dir;
echo cd $Alfresco_backup_dir;
echo "=== Make Mysql Backup ==="
echo mysqldump --user=$user_mysql --password=$user_password $alfresco_db -q --single-
transaction -R -t --disable-keys --complete-insert| bzip2 >
$alfresco_db_$Days.sql.backup

echo "=== Creating Aflresco Repository Backup ==="
echo tar cjfv alfresco_repository_$Days.tar.bz2 $Alfresco_repository
echo "=== Creating Alfresco Indexes Backup ==="
echo tar cjfv alfresco_indexes_$Days.tar.bz2 $Alfresco_indexes
echo "=== Restating Alfresco ==="
echo $Alfresco_root/alfresco.sh start

AparL from Lhe examples descrlbed above, Lhere ls full feaLured backup Lool based on
uupllclLy
14
and Llnux orlenLed a 8ackup and 8ecovery Lool made for Alfresco called A|fresco
8Ak1"
13
(Alfresco 8ackup and 8ecovery 1ool). lL supporLs a varleLy of essenLladls feaLures llke

14
hLLp://dupllclLy.nongnu.org/
13
hLLps://glLhub.com/Lonlblyx/alfresco-backup-and-recovery-Lool
Alfresco Backup and Disaster Recovery White Paper
22
full and lncremenLal backup, encrypLlon, compresslon, l1, Amazon S3, SC or local backups,
resLore wlzard, full and slngle reposlLory flle resLore and more.