Sunday 11 January 2015

Setting up Liferay Clustering



Recently on a project there was the requirement to enable clustering between Liferay portal instances in order to replicate indexing. Without clustering a manually triggered re-index is needed for re-syncing.

This task proved to be more than trivial and so I thought I would share the steps I followed to get unicast clustering working.

Note: This guide was created using two Liferay instances running on Tomcat servers

0.) Ensure that communication is opened up between the two server instances over ports 7800 and 8080.

1.) Add the following line to the server.xml file:

<Connector port=”8080” protocol=”HTTP/1.1” redirectPort=”8443” URIEncoding=”UTF-8” />

2.) Modify tcp.xml file:

a.) Open the jgroups jar file found in the following folder /tomcat-<version>/webapp/ROOT/WEB-INF/lib
b.) Save a copy of the tcp.xml file outside of the jar. i.e. I renamed the file to new_tcp.xml
c.) In the <TCP> section of the new_tcp.xml file add:
     Singleton_name = ”liferay”
d.) In the <TCPPING> section tag update:
     initial_hosts="${jgroups.tcpping.initial_hosts:<server1-name>[7800], <server2-name>[7800]}"
     num_initial_members="2"
e.) Put new_tcp.xml file into your Liferay “classes” folder.
     /tomcat-<version>/webapps/ROOT/WEB-INF/classes/

3.) Update Portal-ext.properties with the following settings:

#clustering
cluster.link.enabled=true
ehcache.cluster.link.replication.enabled=true

#lucene
lucene.replicate.write=true
portal.instance.http.port=8080

#cluser.link.channel.properties
cluster.link.channel.properties.control=new_tcp.xml
cluster.link.channel.properties.transport.0=new_tcp.xml

4.) Download and install “Ehcache Cluster EE” plugin:

a.) Locate “Ehcache Cluster EE” plugin from the liferay market store. You will need to login to the liferay portal site and “purchase” the plugin (it’s free). Once the plug-in has been purchased you will have access to previous versions.
b.) With Liferay stopped put the downloaded plug-in package file in the Liferay deploy folder
c.) Restart Liferay


No comments:

Post a Comment