cancel
Showing results for 
Search instead for 
Did you mean: 

Full repository backup and restore (Server to server)

iann
Champ in-the-making
Champ in-the-making
Hi,

I've been trying to get to the bottom of the problems I've been having over the last few days with trying to backup and restore my Alfresco installation, I've posted in another thread (http://forums.alfresco.com/en/viewtopic.php?f=10&t=23131) but i'm wondering if there's an easier way to back things up.

The processes that i've tried:

http://wiki.alfresco.com/wiki/Backup_and_Restore

Based on the above I've tried:

    Backing up each content store directory individually and then using WGET to send them from server to server
    Backing up the contentstore as a whole as the alfresco store
    I've confirmed that the data is migrated to the new database - I checked the alf_authority table and all users were present as expected.
    I've also tried backing up the database of the new site and then restoring, this works fine so my DB backup / restore process is working
I think I've tried pretty much everything and in exasperation tried using the site explorer tool, although this backups up the content, it doesn't migrate the users and the option for a full repository export seems to have been removed from version 3.2.

Am I missing something simple? Any help would be very greatly appreciated!
9 REPLIES 9

mrogers
Star Contributor
Star Contributor
Backup and restore is the way to go.

iann
Champ in-the-making
Champ in-the-making
I thought so.. Any reason why I might get 404 errors once I've completed the restore? Is there something I'm missing?

mrogers
Star Contributor
Star Contributor
For clues look at your alfresco.log.   The 404 is a symptom of Alfresco not running.

neozone
Champ in-the-making
Champ in-the-making
should we also backup alfresco-global.properties or whole /usr/share/tomcat6/shared/classes ?

mrogers
Star Contributor
Star Contributor
It depends.   If you have all your configuration under version control and can re-install alfresco with all its config via some sort of script then there's no need to back it up since you just re-deploy.

Otherwise I'd simply back up the entire tomcat application server, its not that large.     You probably need to do that sort of back up less frequently.

neozone
Champ in-the-making
Champ in-the-making
I use Alfresco Community 3.2
here this is script i use to backup.

backup.sh
#!/bin/bash
Alfresco_root_dir="/var/lib/alfresco";
Alfresco_backup_dir="/home/myuser/backup/Alfresco_backup";
user_mysql="alfresco";
user_password="alfresco";
alfresco_db="alfresco";

echo "=== Stoping Alfresco ==="
/etc/init.d/tomcat6 stop;
sleep 10;
#echo "=== Remove the directory : $Alfresco_backup_dir ==="
rm -Rf $Alfresco_backup_dir;
#echo "=== Making the directory : $Alfresco_backup_dir ==="
mkdir $Alfresco_backup_dir;
echo "=== Make Mysql Backup ==="
mysqldump -u $user_mysql -p$user_password $alfresco_db > $Alfresco_backup_dir/$alfresco_db.sql.backup;

echo "=== Creating Aflresco dir.root Backup ==="
tar -cvzf $Alfresco_backup_dir/alfresco_file.tar.gz $Alfresco_root_dir;

echo "=== Restating Alfresco ==="
/etc/init.d/tomcat6 start;


and i send whold backup directory to another server with same hostname, ubuntu 9.04, alfresco 3.2

and I use this script to restore
Alfresco_root_dir="/var/lib/alfresco";
Alfresco_backup_dir="/home/myuser/backup/Alfresco_backup";
user_mysql="alfresco";
user_password="alfresco";
alfresco_db="alfresco";

echo "=== Stoping Alfresco ==="
/etc/init.d/tomcat6 stop;
sleep 10;

echo "=== Restore Aflresco dir.root ==="
tar -xvzf $Alfresco_backup_dir/alfresco_file.tar.gz -C $Alfresco_root_dir;

echo "=== Restore Mysql ==="
mysql -u $user_mysql -p$user_password $alfresco_db < $Alfresco_backup_dir/alfresco.sql.backup;

echo "=== Restating Alfresco ==="
/etc/init.d/tomcat6 start;

After I used restore.sh, my new server display this "HTTP Status 404 - "
and alfresco.log

09:53:06,289 INFO  [org.alfresco.config.JndiPropertiesFactoryBean] Loading properties file from class path resource [alfresc$
09:53:06,291 INFO  [org.alfresco.config.JndiPropertiesFactoryBean] Loading properties file from class path resource [alfresc$
09:53:06,291 INFO  [org.alfresco.config.JndiPropertiesFactoryBean] Loading properties file from URL [file:/usr/share/tomcat6$
09:53:06,468 INFO  [org.alfresco.config.JndiPropertyPlaceholderConfigurer] Loading properties file from class path resource $
09:53:49,635 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] Schema managed by database dialect org.hibernate.dialec$
09:53:51,704 INFO  [org.alfresco.repo.domain.schema.SchemaBootstrap] No changes were made to the schema.
09:53:57,751 WARN  [org.alfresco.repo.node.index.FullIndexRecoveryComponent] The indexes are not synchronized with the datab$
09:53:58,493 INFO  [org.alfresco.repo.admin.ConfigurationChecker] The Alfresco root data directory ('dir.root') is: /var/lib$
09:53:58,574 ERROR [org.alfresco.repo.admin.ConfigurationChecker] CONTENT INTEGRITY ERROR: System content not found in conte$
09:53:58,575 ERROR [org.alfresco.repo.admin.ConfigurationChecker] Ensure that the 'dir.root' property is pointing to the cor$
09:53:58,582 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 10160000 Ensure that the 'dir.root' property is pointing to the correct data lo$
        at org.alfresco.repo.admin.ConfigurationChecker.check(ConfigurationChecker.java:312)
        at org.alfresco.repo.admin.ConfigurationChecker.access$000(ConfigurationChecker.java:72)
        at org.alfresco.repo.admin.ConfigurationChecker$1.execute(ConfigurationChecker.java:178)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:326)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:252)
        at org.alfresco.repo.admin.ConfigurationChecker.onBootstrap(ConfigurationChecker.java:182)
        at org.alfresco.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:62)
        at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:$
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticas$
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:246)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:617)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:355)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:189)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:69)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4338)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177)
09:54:04,830 INFO  [org.alfresco.config.JBossEnabledWebApplicationContext] Refreshing org.alfresco.config.JBossEnabledWebApp$
09:54:05,546 INFO  [org.alfresco.config.JBossEnabledWebApplicationContext] Bean factory for application context [org.alfresc$
09:54:09,889 INFO  [org.alfresco.web.scripts.DeclarativeRegistry] Registered 24 Web Scripts (+0 failed), 26 URLs
09:54:10,095 INFO  [org.alfresco.web.scripts.AbstractRuntimeContainer] Initialised Presentation Web Script Container (in 618$
09:54:11,412 INFO  [org.alfresco.web.scripts.DeclarativeRegistry] Registered 171 Web Scripts (+0 failed), 173 URLs
09:54:11,476 INFO  [org.alfresco.web.scripts.AbstractRuntimeContainer] Initialised WebFramework Web Script Container (in 136$
09:54:12,864 INFO  [org.alfresco.web.site.FrameworkHelper] Successfully Initialized Web Framework


Did i do something wrong ?

zaizi
Champ in-the-making
Champ in-the-making
Backing up an Alfresco repository involves backing up the directory pointed to by the dir.root setting AND the database Alfresco is configured to use. Backing up either one without the other results in a backup that cannot be successfully restored.

Similarly, when you restore an Alfresco backup you must restore both the dir.root directory AND the Alfresco database from the same backup set - restoring either one in isolation is guaranteed to corrupt your repository.

Read the wiki: http://wiki.alfresco.com/wiki/Backup_and_Restore

neozone
Champ in-the-making
Champ in-the-making
Backing up an Alfresco repository involves backing up the directory pointed to by the dir.root setting AND the database Alfresco is configured to use. Backing up either one without the other results in a backup that cannot be successfully restored.

Similarly, when you restore an Alfresco backup you must restore both the dir.root directory AND the Alfresco database from the same backup set - restoring either one in isolation is guaranteed to corrupt your repository.

Read the wiki: http://wiki.alfresco.com/wiki/Backup_and_Restore

sure I read already.
Did u see my script ?
my dir.root is /var/lib/alfresco that mean in my alfresco-global.properties has "dir.root=/var/lib/alfresco"
for backup database, I use this
echo "=== Make Mysql Backup ==="
mysqldump -u $user_mysql -p$user_password $alfresco_db > $Alfresco_backup_dir/$alfresco_db.sql.backup;
and dir.root
tar -cvzf $Alfresco_backup_dir/alfresco_file.tar.gz $Alfresco_root_dir;

and also same for restore procedure
dir.root
tar -xvzf $Alfresco_backup_dir/alfresco_file.tar.gz -C $Alfresco_root_dir;
database
mysql -u $user_mysql -p$user_password $alfresco_db < $Alfresco_backup_dir/alfresco.sql.backup;

and this what it said in cold procedure
   1.  Stop Alfresco.
   2. Backup the database Alfresco is configured to use, using your database vendor's backup tools.
   3. Backup the Alfresco dir.root directory in its entirety.
   4. Store both the database and Alfresco dir.root backups together as a single unit. For example, store the backups in the same directory or compressed file.
   5. Start Alfresco.

What process I wrong ?

jdeclerck
Champ in-the-making
Champ in-the-making
Hi,

I've just ran your script on my machine, and after looking the sql dump, it seems that file is almost empty.

Have a look at the mysqldump command. A few months ago I made a script that worked but I can't get my hand on it right now.

I'll post if I can have it working soon.

EDIT : I've used this command to dump the mysql database:
mysqldump –user=alfresco –password=alfresco alfresco –opt –create-options > alfresco_backup.sql

This dump the structure as well as the content. I've tried it and it works.

Regards,
Joseph.