Clustering with the Liferay platform can be achieved by using UDP Multicast, UDP Unicast and TCP Unicast. While Multicast is being used by default, there are cases where UDP Multicast is not available or disabled at the infrastructure level. In such cases, TCP Unicast can be used for clustering with the Liferay platform.
This article introduces the steps required to setup Liferay platform clustering with TCP Unicast by using 2 Liferay 6.2 Portal EE nodes. The same instructions apply to corresponding enterprise infrastructure and Amazon AWS.
To achieve TCP Unicast clustering for a Liferay environment, the following steps must be performed on each of the clustered Liferay instances.
Ensure the Related Ports are Open
For Liferay clustering to be successful, the hosts need to communicate with each other to send clustering packets across the network. Besides TCP Ping and S3 Ping, which are introduced in the following sections, more options to configure Liferay clustering can be found here: Managing Liferay Portal's Distributed Cache.
- Configure TCP Unicast
The following steps configure an XML file containing the TCP Unicast configuration. A recommended way to configure this XML file is to first obtain an original copy of it from
[Liferay_Home]\[Tomcat_Home]\webapps\ROOT\WEB-INF\lib\jgroups.jar\tcp.xmland then make your own adjustments based on the default values provided there. In Liferay DXP 7.1 and above, tcp.xml is located in [Liferay_Home]/osgi/marketplace/Liferay Foundation - Liferay Portal - Impl.lpkg --> com.liferay.portal.cluster.multiple-[version].jar --> lib/jgroups-[version].Final.jar --> tcp.xml
Once you have finished configuring your own XML file, the easiest way to continue is to place the XML file in the global library of the Application Server so that the Liferay instance can read the XML file upon startup. Otherwise, the detailed paths as well as the XML file names must be specified in the*Note: For an AWS environment:
An Amazon S3 bucket that is accessible by all of the clustered Liferay instances must be created before including the related bucket information in the XML file. More details on configuring the XML file can be found: Managing Liferay Portal's Distributed Cache.
- Add Properties to portal-ext.properties
Besides the portal properties required for Liferay clustering, some additional properties must also be specified in
portal-ext.propertiesfor the Liferay instances to pick up the settings from the configured XML file. A full set of the required portal properties are listed as follows:
cluster.link.enabled=true cluster.link.autodetect.address= www.google.com:80 ehcache.cluster.link.replication.enabled=true cluster.link.channel.properties.control=Path_to_the_XML cluster.link.channel.properties.transport.0=Path_to_the_XML # Only needed when Lucene is being used lucene.replicate.write=true
- Deploy the Ehcache Cluster EE Application
The Ehcache Cluster EE plugin is required to be deployed to all of the clustered Liferay instances before the Liferay cluster environment is up and running.
- Start the Liferay Cluster and Verify
To verify that clustering is working as expected, please refer to the tests listed here: Installing Liferay Portal in a Clustered Environment and Testing if Cluster Link is Working.
- To tell the Liferay platform to display which node processed the request on every page set:
Note: This can be hidden with CSS.
- To enable clustering debugging traces set:
When using JGroups, ensure that all the configuration information is synced. For example, the most recent fix pack may contain the latest version of JGroups that is different than the one that ships with Liferay.