Wednesday, July 10, 2019

Liferay Database Migration from 6.2.0.1-CE to 7.1.0-CE-GA1

Hi All,

This post details the steps to be taken care when you do the migration/upgrade process of database of liferay from 6.2.0.1-CE to 7.1.0-CE-GA1

1. Backing up the Database.
The first and the foremost one is to back up you old data... this can be achieved by taking the database dump of the portal, In my case I was using MYSQL as my back end, you can check the respective sites on How to take the database dump? if you use any other database server.

For MySql, the command given below would take the DB Dump of the data.
> mysqldump --routines --add-drop-table --disable-keys --extended-insert --host=localhost --port=3306 --user=root --verbose lportal --password > serverdump-of-database-lportal.sql
The above command takes the database dump and store it in a file named serverdump-of-database-lportal.sql (Assuming lportal is the database that liferay portal uses)

The above file can be used in case if there is a need to restore the database.

2. Creating a new database for the migration/upgrade
you can use the existing database or create a new one for the migration/upgrade, In the sense.... the database lportal database that liferay portal uses can be used, if you want the old database to be untouched, you can create a new one and restore the data that we dumped from the previous step.

Well, I am going to use the later one that is, a new database will be created and then the rest of the upgrade process would be continued....

To create a new database use the following command after login to the database server.

To login to the MySql Database Server
> mysql -u root -p
the above command would ask you to provide the password, provide the one associated with the root user account.

At the mysql prompt, fire the command to create a new database.
mysql> create database lportal_migration;
Now we have a empty database, the next step is to dump this database with the file that we have created in the previous step.

exit from mysql prompt, and fire the command below to populate the data...
> mysql -u root -D lportal_migration -p < serverdump_of_database-lportal.sql
the above command would take some time to complete the operation, relax till then.

Once the above operation is completed, you can the check the database by logging back in to the database server.

3. Installation of new liferay portal - 7.1.0-CE-GA1
You can download the said portal at the below mentioned location and unpack it to your favourite locaiton.

The next important step is to move the document_library of the old portal instance to the new portal instance

Just copy paste the document_library folder available at <liferay-portal-6.2.0.1-installation-path>/data/document_library to the location <liferay-portal-7.1.0-CE-GA1-installation-path>/data folder

if you find any other folder along with document_library, please move them too...

4. Creating portal-setup-wizard.properties File
You have to create a file named "portal-setup-wizard.properties" at the home location of the portal i,e <liferay-portal-7.1.0-CE-GA1-installation-path>/

Open the file in your favourite text editor and append the file with the lines given below...
jdbc.default.url=jdbc:mysql://localhost:3306/lportal_migration?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.username=root
jdbc.default.password=admin
setup.wizard.enabled=true
liferay.home=<installation-path-of-liferay-ce-portal-7.1.0-ga1>

5. Creating com.liferay.portal.upgrade.internal.configuration.ReleaseManagerConfiguration.config file
At the location <liferay-portal-7.1.0-CE-GA1-installation-path>/osgi/configs, create a file named "com.liferay.portal.upgrade.internal.configuration.ReleaseManagerConfiguration.config".

Open the file in a text editor and append the file with the following line
autoUpgrade="false"

6. Creating com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config file
At the location <liferay-portal-7.1.0-CE-GA1-installation-path>/osgi/configs, create a file named "com.liferay.portal.search.configuration.IndexStatusManagerConfiguration.config".

Open the file in a text editor and append the file with the following line
indexReadOnly="true"

7. Updating appserver.properties file
At the location <liferay-portal-7.1.0-CE-GA1-installation-path>/tools/portal-tools-db-upgrade-client/ you would find a file named "appserver.properties"

Open the file in a text editor and uncomment the lines you find under "Tomcat" and save the file.

8. Updating portal-upgrade-database.properties
At the location <liferay-portal-7.1.0-CE-GA1-installation-path>/tools/portal-tools-db-upgrade-client/ you would find a file named "portal-upgrade-database.properties"

Open the file in a text editor and replace the lines under ##MySql section as said below...
FROM :
#jdbc.default.driverClassName=com.mysql.jdbc.Driver
#jdbc.default.url=jdbc:mysql://localhost/lportal?characterEncoding=UTF-8&dontTrackOpenResources=true&holdResultsOpenOverStatementClose=true&useFastDateParsing=false&useUnicode=true
#jdbc.default.username=
#jdbc.default.password=

TO :
jdbc.default.url=jdbc:mysql://localhost:3306/lportal_migration?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.username=root
jdbc.default.password=admin
Save the file.

9. Updating portal-upgrade-ext.properties file.
At the location <liferay-portal-7.1.0-CE-GA1-installation-path>/tools/portal-tools-db-upgrade-client/ you would find a file named "portal-upgrade-ext.properties"

Open the file in a text editor and edit the file as said below
FROM :
#liferay.home=../../

TO :
liferay.home=<liferay-portal-7.1.0-CE-GA1-installation-path>
module.framework.base.dir=../../osgi

10. Running the "db_upgrade.sh" file.
This is the last step in the process, open up a terminal and navigate the folder <liferay-portal-7.1.0-CE-GA1-installation-path>/tools/portal-tools-db-upgrade-client/ and run the file at the file terminal
> ./db_upgrade.sh
In Case of windows operation system use the file "db_upgrade.bat"

During the upgrade process, if you encounter any error, you have to repeat the steps from the beginning.

Well that is it hope this post helped you in upgrading the database from 6.2.0.1 to 7.1.0

Thanks.


How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...