Liferay Database migration from 6.2 to 7.1/DXP

blog-banner

Now, ready to upgrade database Liferay 6.2 to 7.1,  Liferay 7.1/DXP  gives upgrade tool to upgrade everything. It’s the best, most comprehensive thanks to upgrade tool provided by Liferay. Please follow below steps to upgrade database(Steps are given for both Ubuntu/Window).

Steps:

1. Create a new database for Liferay 7.1/DXP in MySQL server

e.g. create database  Liferay_dxp_db  character set utf8

2. Take backup and restore

Create a database dump from liferay 6.2 database and restore that dump into a new liferay 7.1/DXP database

  • Open database terminal(Workbench)

  • Take back up

    mysqldump -u[username] -p[password]  liferay_old_db > liferay_dump_file.sql

    - Linux

    To create dump file : mysqldump -uroot -proot  liferay_old_db > liferay_dump_file.sql

    To restore dump file into new DB(Liferay 7.1/DXP) : mysql -uroot -proot  liferay_dxp_db < liferay_dump_file.sql

    - Window

    Open CMD with administrator

    cd C:\Program files\MySQL\MySQL Server 5.7\bin

    run below command

    To create dump file : mysqldump -uroot -proot  liferay_old_db > C:\liferay_dump_file.sql

    To restore dump file into new DB(Liferay 7.1/DXP) : mysql -uroot -proot  liferay_dxp_db < C:\liferay_dump_file.sql

3. Specify database connection properties

Create a file ‘ portal-setup-wizard.properties ’ and specify the below DB connection properties within it:

jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost:3306/liferay_dxp_db
jdbc.default.username=root
jdbc.default.password=root

Note:  DO NOT START Liferay DXP server at this point. Otherwise, you will get an error like java.lang.RuntimeException

4. Copy data

Copy document_library (You can find from [Liferay Home]/data/) folder from Liferay 6.2 to Liferay 7.1/DXP, copy images folders into data folder also. This data will be stored in the default store and you can also choose your location, it's up to your choice.

5. Disable indexer and autoUpgrade

Now, we need to disable indexing since we are going to start the database upgrade process for our new environment. Using this we can disable reindexing content and performance issues to be arised. For this, we have to follow below steps.

  • Need to create file in liferay 7.1/DXP :

    " com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config " on this location [Liferay Home]/osgi/configs and add below content

    indexReadOnly="true"
    

    Then create another file in the same folder :

    " com.liferay.portal.upgrade.internal.configuration.ReleaseManagerConfiguration.config " and add below content

    autoUpgrade="false"
    

6. Configure the upgrade tool

Unlike previous Liferay versions, here we just need to specify database configuration properties, and database upgrade process will run upon liferay server startup, Liferay 7.x provides a dedicated tool for database upgrade 'portal-tools-db-upgrade-client' in [Liferay Home]/tools folder

Now, we need to configure below files before running the upgrade:

  • Tomcat configuration in Liferay

  • Liferay portal upgrade database properties

  • Liferay portal upgrade database ext.properties

7. Verify buildNumber

We have to check a release buildNumber from DB before running the upgrade tool, it will be incremented after each deployment in Service Builder which is used for generating internal database persistence code.

Using this query you can find current buildNumber:

  • Liferay 6203 buildNumber

    Run upgrade tool using below command (Path [Liferay Home]/tools folder) :

    For window

    Double click on “ db_upgrade.bat ” file

    For Ubuntu

    sh db_upgrade.sh

  • Liferay core upgrade

  • Liferay 7100 buildNumber

8. Enabling indexer

Now, The last and most important step is remaining which can only be taken post-upgrade and to enable indexer. For this, you have to modify the file " com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config " in the folder [Liferay Home]/osgi/configs with the following content

indexReadOnly="false"

Good job , You’re almost at the end. Now let’s start Liferay.

Contact us

For Your Business Requirements

Text to Identify Refresh CAPTCHA
Background Image Close Button

2 - 4 October 2024

Hall: 10, Booth: #B8 Brussels, Belgium