Backup and restore

Étiquettes: mysql backup restore

Alternative Languages: 日本語

It is quite easy to create a backup of a Liferay installation, and to restore it later on. A restore of an existing Liferay instance is even useful when setting up a local development environment with existing content.

This backup and restore procedures targets a Liferay 6.0 installation with a MySQL database.

Backup procedure #

  1. Create a dump of your database, in order to transfer it to another environment. The '-q' option allows for better performance for big environments, as it dumps directly to stdout.
    $> mysqldump -u root -p -q lportal > lportal_backup.bak
  2. Zip the document_library folder, which contains all documents and files from the document library.You don't need the lucene directory, as this can be generated from scratch; based on the DB and document library.

That's it, it couldn't be easier than this!

Restore procedure #

The restore is a bit more complex, but nevertheless still quite easy to perform. We will start with a new database, and import from the dump we've created in the backup procedure.

  1. Open a connection to your MySQL database and perform the following command:
    $mysql> CREATE DATABASE lportal CHARACTER SET UTF8;
  2. Copy the document_library folder to your Liferay data folder.You can find the location of the document library in
    portal-ext.properties: dl.hook.file.system.root.dir
  3. Import the database backup in your newly created database with following command:
    $mysql> mysql -u root -p lportal < lportal_backup.bak
  4. Start the Liferay server.This would trigger possible automatic migration procedures.
  5. Regenerate the Lucene index, by navigating to the Control Panel, Server Administration, and than execute the Action: Re-index (this may take a while, depending on the data size of your db/doc-library)

Restore from a different application server (EE only) #

If you are restoring your Liferay instance from a different application server (e.g. from WebSphere to Tomcat), you need to perform following additional steps because the cryptography libraries of the application server may be used to encrypt/decrypt certain data.

You need to perform following steps when getting exceptions that rely to encryption, when trying to perform a login:

  1. Retrieve the current companyId and accountId from your database, and write them down:
    $mysql> SELECT companyId, accountId FROM company;
  2. Clear the company table that contains they 'key_' in encrypted form, example:
    $mysql> DELETE FROM company WHERE companyId=10113 and accountId=10115
  3. Restart your application server, which will make sure the company table is populated again. It will automatically create a new company when it cannot find the desired one, creating a key that's valid for your new JVM.
  4. The companyId and accountId will have invalid values. We need to reset them to the values from step 1:
    $mysql> UPDATE company SET companyId=10113;
    $mysql> UPDATE company SET accountId=10115;
  5. Restart Liferay once again to make sure all settings are adapted.
Moyenne (0 Voter)
L'estimation moyenne est de 0.0 étoiles sur 5.
Commentaires
Réponses Auteur Données
Is there any automated process for same? I am... Nilesh Gundecha 30 octobre 2011 22:58

Is there any automated process for same?

I am looking for something like what we have "Restore Point" in Windows OS.

Regards,
Nilesh
Publié le 30/10/11 22:58.