Fórum

Portal backup and restore

Jaafar Altaie, modificado 11 Anos atrás.

Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
If need to install or upgrade the existing LIferay bundle is there any way I can backup and restore the contents of the current portal instead of having to rebuold the portal from scratch?

I'm looking at sections in the community such as:

http://www.liferay.com/community/forums/-/message_boards/message/970939

So my question is if I do a dump copy of the mySQL DB would the restoration impact the new DB installation in any way or can the dump restore simply overwrite the newly created mySQL schema that gets created when I reinstall and configure LIferay? When re-installing LIferay do I need to manually configure the DB?

Is there any way I could also back up and restore the actual portal contents without restoring the corrupt elements of the current installation?


Thanks!
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
If you need to upgrade, doing a dump and restore of a database won't do it because the table DDL are different. You'll have to use liferay's upgrade mechanism.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
What is the LIferay mechanism to back up and restore an entire portal including the database and web interface format?

If the current Liferay installation is simply corrupt and I want to reinstall and older or newer version, how do I do it? I haven't really seen a complete guide for backing up a portal (including mySQL Demoticon and restoring it after downloading and installing a new LIferay version. I'm looking at the following guide:

http://www.liferay.com/documentation/liferay-portal/6.0/administration/-/ai/backing-up-a-liferay-installati-4


But this doesn't really provide a comprehensive explanation. Any suggestions about a complete (end to end) back up and restore method? Thanks!
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
I'd grab a snapshot of mysql before the upgrade starts. If the upgrade fails, drop the database and recreate from the snapshot.

Don't forget to do the same with the data directory, as the data directory has indexes and other stuff that may get changed during the upgrade.

Be sure to do both of these things when Liferay is not running so you get clean backups of both.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
David,

I guess my question is more specifically, this:

Besides grabbing a snapshot of the DB, which particular files, folders, parts of the Liferay installation do I need to back up and how to do I restore these to a new Liferay installation to fix previously corrupted installations? Are there any specific steps I should take for doing a complete re-installation for a corrupt LIferay installation? Thanks, J
alim amr, modificado 11 Anos atrás.

RE: Portal backup and restore

New Member Mensagem: 1 Data de Entrada: 19/06/12 Postagens Recentes
Hi,

I have the same above problem, I want to know little more details for backup like, lets say:

Besides grabbing a snapshot of the DB,

1) which particular files, folders, parts of the Liferay installation do I need to back up and

2) How to do I restore these to a new Liferay installation to fix previously corrupted installations?

3) Are there any specific steps I should take for doing a complete re-installation for a corrupt LIferay installation?"

Thanks,
thumbnail
Sandeep Nair, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Besides Database as David said, I would backup data folder(which consists lucene indexes,uploaded documents,etc) which is in LIFERAY_HOME directory.

If you are using jackrabbit as file repository and have stored all the files in database then you have to have the snapshot of jcr db as well.

Keep a backup of portal-ext.properties too.

Regards,
Sandeep
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
So the first step of backing a mySQL db seems to be fairly straightforward with a number of methods to get the right snapshot. I am opting to use the mysqldump utility.

The next step of restoring a new LR installation could be more tricky. Which directories / files need to be copied to restore the same build whereby the original pages can be restored. For example, there's a page containing a content management plugin (Not Lucene or Jackrabbit -just plain old Liferay generic plugin). How do I copy that? Which file / folder do I need to copy? Is restoring after the new Liferay installation just a question of pasting the copied folder / files into the new installation so that the pages in the new installation can talk to the restored database? In other words, which files and folders do I need to copy to preserve the functionality of my original installation?

Either I'm missing something really obvious or there's no easy way to back up and restore the functionality of an existing installation. Maybe it's just quicker and easier to rebuild an entire portal if making a new Liferay installation? please advise! THANK YOU
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
When you are ready to make a backup, run mysqldump for the database portion and an archive utility to do the data directory (i.e. zip or tar/bz2 for example). These two go together and are definitely tied to each other. Liferay should not be running when you do this.

When you are ready to restore from a backup, restore the database from the dump and replace the contents of the data directory w/ the archive (delete the contents of the directory and extract the archive contents back to the directory). Liferay should not be running when you do this.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
David,

Exactly the kind of info i was after. Thank you! I'd just like to know a couple of things about the data directory:

1) Is there only one main data directory located (on my file system) in M:\liferay\xtract\liferay-portal-6.1.0-ce-ga1\data?


2) Does the contents of the data directory also controls the page structure of the portal? So if i restore the contents of the directory does this also restore the structure of the portal or will I need to rebuild / re-create the relevant pages that correspond to the documents and data?

Thanks again!
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
1. The default is only a single data directory, but you can actually specify different locations for the various parts of data using portal-ext.properties (to move the lucene indexes, the jackrabbit repository, etc.).

2. The layout and definition stuff is in the database. Images, documents, etc. will (normally) be in the filesystem.

You really shouldn't try to do a restore of only one of the pieces (database or filesystem) as you'll end up with missing pieces. If you're going to restore one, restore them both. Trust me, you don't want to try to rebuild either of these manually...
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
Well this is what I'm confused about because the LAST thing I want to to do is build either the DB or portal manually. I want to know which sections to back up and restore to get an exact duplicate portal working on a new LIferay installation.

From what you're telling Am I right to assume that backing up and restoring the DB and the data directory will give me an identical portal on my new Liferay installation?

Thanks!
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Yes, if you grab both and restore them somewhere else, you'll have an exact copy of the current site at the time the backup was completed.

Note that this does not include any of the plugins you may have deployed (so if you deployed a theme and have all of the pages using this theme when you do the export, importing to a clean Liferay install w/o the theme will end up w/ errors in the log).

Cloning an environment should also include all deployed plugins (portlets, themes, hooks, etc.) on top of the database and filesystem components.
Linus Sphinx, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 99 Data de Entrada: 12/08/10 Postagens Recentes
If I copy all the deployed plug-ins that don't come in a bundle from the prior version will it upgrade them like the database?

------------------------
#!/bin/bash
# @author: sphinx 6.11.2011
# old/new version numbers for LIFEray and TOMcat
OLDLIFE=6.0.6
OLDTOM=6.0.29
NEWLIFE=6.1.0-ce-ga1
NEWTOM=7.0.23
# sanctioned are portlets we provide, do *not* over write but copy all other portlets users have installed
SANCTIONED="chat-portlet google-maps-portlet kaleo-web organizations-map-portlet ROOT weather-portlet wsrp-portlet docs ip-geocoder-portlet list-portlet organization-users-1.0 tunnel-web web-form-portlet"

# copy portlets not included
export SANCT="FALSE"
for i in `ls /usr/local/liferay-portal-${OLDLIFE}/tomcat-${OLDTOM}/webapps/`
do
for j in $SANCTIONED
do
if [ $j == $i ]; then
export SANCT="TRUE"
fi
if [ "$SANCT" == "FALSE" ]; then
cp -pr /usr/local/liferay-portal-${OLDLIFE}/tomcat-${OLDTOM}/webapps/$i /usr/local/liferay-portal-${NEWLIFE}/tomcat-${NEWTOM}/webapps/
fi
done
done
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
Some of the plugins may be compatible between 6.0.6 and 6.1.0, but this is not guaranteed.

Personally I'd grab the 6.1.0 SDK and use it to re-build the plugins (after tweaking them in the new SDK directory, i.e. update the themes to have 6.1 compatibility, fix any compile errors encountered, etc.).

Bring the 6.1.0 environment up using the HSQL guy to make sure the instance is ready to go.

Then point the instance at the restored database and data directory, start it up and then go through the process of dealing w/ upgrade failures.
Linus Sphinx, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 99 Data de Entrada: 12/08/10 Postagens Recentes
Whoa, sounds like manual labor! Will eventually need to do an upgrade on a rather large farm of these, all have had users wildly installing different things and I'm the only guy on the server team. Thinking more something like automate locating the latest binary version of plug-in in the Marketplace and copy that into the deployment directory and let it install on start up?
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Thinking more something like automate locating the latest binary version of plug-in in the Marketplace and copy that into the deployment directory and let it install on start up?


Just downloading and installing directly a plugin from a Marketplace on to a production server is asking for touble. Even with Liferay.com, there's so many new bugs in newer versions that may cause server to error.

Most of the time, I have to download a plugin on to my test server, fix it, and make it available to my users.

Production server needs high quality "software" and not high quality "support". I need my servers from not crashing more than I need assistance after my server goes down. :-)
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
Going back to basics and at the risk of sounding pedantic, would the following steps work for backing up and restoring a LIferay install:

DATABASE
1) Backup mydb_life
2) Delete mydb_life
3) Verify deletion
4) Restore mydb_life from backup


LIFERAY
5) Backup / Copy Liferay data folder
6) Shutdown Liferay
7) Uninstall Liferay
8) Re-extract / reinstall LIferay
9) Replace existing data folder with backed data folder
10) Configure database in new installation wizard

?
thumbnail
David H Nebinger, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 14914 Data de Entrada: 02/09/06 Postagens Recentes
It would be more like:

1. shut down liferay tomcat server.
2. backup database.
3. backup data directory.
4. restart liferay tomcat server.

When the restore needs to occur:

1. shut down liferay tomcat server
2. delete database.
3. restore from backup.
4. delete data directory.
5. restore from backup.
6. restart liferay tomcat server

Note that liferay is shutdown throughout the backup/restore process to ensure that there are no concurrent modifications going on.

Liferay doesn't change during this process (nor does it need to). You do not have to delete liferay bundle, do not have to reinstall it, do not have to re-run the wizard...

All you're doing is replacing the current database and data w/ previously used info.

Those are the steps only for backup/restore. You mentioned cloning one liferay instance to another location that has slightly different steps.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
IN an earlier thread (http://www.liferay.com/community/forums/-/message_boards/message/14243215) LIferay staff told me there could be a problem with the version of my installation. So I'm assuming if I'm going ot reinstall it should be as clean as possible, while retaining the basic data and structure. So how would the steps you described apply to that situation? Obviously my aim is to backup and restore content without restoring bugs and problems of the prior install.
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
You can only backup and restore to the EXACT same version of liferay including plugins. If you need to use newer version, you'll need to do data migration after moving to the new environment.

If your database is corrupt, doing a backup and restore would fix the problem. Better approach is to export and import each data.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
Hitoshi,

Lifereay suggests that I use the latest version of Liferay portal and plug ins because I can't seem to get custom plugins to work on my existing installation. SO, I want to go to a newer version in which case what is the procedure for data migration?

I'm going to try back up and restore first. If that doesn't work please let me know the process for doing data migration to a newer version and/or where to find DETAILED instructions on doing data migrations. I already have the book Liferay in Action (which contains very little on this subject), I've read some of the user documentation which seems to cover general concepts of back and restore, but I can't seem to find a detailed, definitive guide on how to back up, restore, migrate, etc.

What I'm looking for is a detailed walk through. I do understand the concept and theory of back up restore, migration, etc but actually applying seems to differ from version to version of Liferay so I need a walk through on the latest Liferay portal version (Tomcat bundle). Hope that is available somewhere.

Many thanks!
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Lifereay suggests that I use the latest version of Liferay portal and plug ins because I can't seem to get custom plugins to work on my existing installation. SO, I want to go to a newer version in which case what is the procedure for data migration?


Yes, that may be Liferay's suggestion but do you really all the new functionalitieis? Do they really work as expected? For example, Liferay 6.1.0CE is very buggy and has a
performance and resource usage problem as well. In all, it's very unsuitable for production. Even Liferay.com hasn't versioned up this site to 6.1 EE yet.

IMHO, the current stable release is 6.0.6 but I have to say that there are some bug which you may have to fix to get it working for your system.

How about checking out the version if you can run it stably before spending time on migration and development. It may save you a lot of time and headche.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
Good advice. I'll download, install and try 6.06. If this is stable I'm guessing I will have to migrate the existing data. My current version is (liferay-portal-6.1.0-ce-ga1). So will it be possible to migrate and restore to an older version? Any idea on where I can find detailed instructions? Thanks
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
So will it be possible to migrate and restore to an older version?


Sorry no. If you download liferay's source code, there is a sql directory which has update-xxx.sql script files.
You can look at the sql statements and try to write a reverse script to downgrade.
Linus Sphinx, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 99 Data de Entrada: 12/08/10 Postagens Recentes
Migration is a subject unto itself and is not working all that hot for me at the moment, but backup and restore in a MySql innodb environment I might be of some help. I use http://www.percona.com/doc/percona-xtrabackup/ as it will do it hot without shutting it down. Find the one that matches your version.
Create a folder to hold your backups and an event to run your backup script every night from cron;
# mkdir /usr/local/backups
# echo "0 23 * * * /usr/local/backups/backup.sh >> /usr/local/backups/backup.log 2>&1" | crontab - -u mysql

In the /usr/local/backups directory create two scripts, this one to backup name it /usr/local/backups/backup.sh:
#!/bin/bash
USER=foo
PASS=assword
BACKUPDIR=/usr/local/backups
SOCKET=/var/lib/mysql/mysql.sock
RETENTION=7

function error_exit {
   echo "Problem - check logs"
   touch $BACKUPDIR/FAIL
}

echo "**********************************************"
echo "Start of backup"
echo "**********************************************"
innobackupex-1.5.1 --user=$USER --password=$PASS --socket=$SOCKET --stream=tar . | gzip -c -1 > $BACKUPDIR/backup.`date +%Y-%m-%d-%H-%M-%S`.tar.gz
if [ $? != 0 ]; then
 error_exit
fi
echo "Removing old files"
find $BACKUPDIR -mtime +$RETENTION -name "*.gz" -print -exec rm {} \;
if [ $? != 0 ]; then
 error_exit
fi
echo "**********************************************"
echo "End of Backup"
echo "**********************************************"

this one to restore, name it /usr/local/backups/restore.sh; NOTE: this wipes out and restores the entire database, assumes you have nothing but your portal on it.
#!/bin/bash
# restore.sh - restore an xtrabackup tar.gz file
USER=foo
PASS=assword
function usage 
{
 cat << EOF

Restore an xtrabackup tar.gz file and replace a mysql database.

usage: $0 options

OPTIONS:
   -b      Name of the tarred and gzipped database backup to restore
   -h      Show this message

EOF
}
TARFILE=
while getopts "b:h?" OPTION
do
 case $OPTION in
   b)
     TARFILE=$OPTARG
     ;;
   h)
     usage
     exit 1
     ;;
   ?)
     usage
     exit 1
     ;;
 esac
done
if [[ -z $TARFILE ]]; then
 usage
 exit 1 
fi
echo Beginning restoration of $TARFILE ...
BACKUPDIR=/usr/local/backups/${TARFILE%.tar.gz}
if [[ -e $BACKUPDIR ]]; then
 echo removing directory from prior run
 rm -rf $BACKUPDIR
fi
mkdir -p $BACKUPDIR
tar xifz $TARFILE -C $BACKUPDIR
innobackupex-1.5.1 --user=$USER --password=$PASS --apply-log $BACKUPDIR
/etc/rc.d/init.d/mysqld stop
rm -rf /var/lib/mysql/*
innobackupex-1.5.1 --copy-back $BACKUPDIR
chown -R mysql:mysql /var/lib/mysql
/etc/rc.d/init.d/mysqld start
echo Restoration of $TARFILE complete.
rm -rf $BACKUPDIR

Now you have scheduled backups that will keep a weeks worth of snapshots and clean out the old on your database, just add a sister event on your portal server to tar up at least the data directory of liferay or more depending on how much you change it at about the same time and you're good to go. Just check the timestamps and restore them as a pair.
Traolly Xiong, modificado 10 Anos atrás.

RE: Portal backup and restore

Regular Member Postagens: 195 Data de Entrada: 30/12/11 Postagens Recentes
Hello ,
Do we have to be concerned about the plugins under webapps dir when doing the restore?

Thoughts?

Regards,
TRX
Linus Sphinx, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 99 Data de Entrada: 12/08/10 Postagens Recentes
Users of MySql might want to check out xtrabackup too.
http://www.percona.com/doc/percona-xtrabackup/
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Users of MySql might want to check out xtrabackup too.
http://www.percona.com/doc/percona-xtrabackup/


Thanks for the information. Being able to do a online backup really looks interesting.
Our operation center was having trouble with it.
thumbnail
Mika Koivisto, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens Recentes
When you backup Liferay you should make sure that both the filesystem backup and database backup are consistent otherwise you might have some file references in database that are not in the data/document_library folder or wise versa. I blogged about how to take a consistent Liferay backup last month and even created and shared a script for it.
Jaafar Altaie, modificado 11 Anos atrás.

RE: Portal backup and restore

Junior Member Postagens: 69 Data de Entrada: 26/04/12 Postagens Recentes
Mika,

This is really useful, but is this backward compatible? Ie: If I'm downgrading from v6.1 to 6.0 can I still point the mySQL to the 6.1 DB? I tried doing that in the 6.0 portal-ext.properties and it gave errors.

The 6.0 installation works with a DB created by a prior 6.0 installation but seems to run into problems if it points to a DB created by a higher version.
thumbnail
Mika Koivisto, modificado 11 Anos atrás.

RE: Portal backup and restore

Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens Recentes
You can't downgrade Liferay database.