Unicast with JGroups (RMI)

Liferay Support does not recommend or endorse specific third-party products over others. Liferay is not responsible for any instructions herein or referenced regarding these products. Any implementation of these principles is the responsibility of the subscriber.

This article outlines how to configure TCP Unicast on Liferay Portal 6.1 specifically with Tomcat 7.0.25.

Resolution

First, to complete the following steps you will need 2 instances of Liferay 6.1 EE.
 
1. In ${TOMCAT_HOME}/webapps/ROOT/WEB-INF/lib/portal-impl.jar, look in the ehcache folder and extract the following 2 files:
- liferay-multi-vm-clustered.xml
- hibernate-clustered.xml
 
Alternatively, these files can be found in the Liferay Source Code here ${SOURCE_CODE}/portal-impl/src/ehcache.
 
2. In ${TOMCAT_HOME}/webapps/ROOT/WEB-INF/classes, create a folder called "ehcache" and place the two files there.
 
3. In both files, find this class
com.liferay.portal.cache.ehcache.LiferayCacheManagerPeerProviderFactory
and replace it with
net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory
 
4. For hibernate-clustered.xml, in the properties section of the replaced class, change it to this:
 
"connect=TCP(bind_port=18200;bind_addr=192.168.97.162;stats=true):TCPPING(initial_hosts=192.168.97.162[18200],192.168.97.146[18801];port_range=10;timeout=3000;num_initial_members=2;up_thread=true;down_thread=true;stats=true):VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):pbcast.GMS(join_timeout=125000;join_retry_timeout=12000;shun=false;print_local_addr=false;down_thread=true;up_thread=true;stats=true)"
 
In the above change, there are two nodes: 192.168.97.162, and 192.168.97.146. 162 is using port 18200, and 146 is using port 18801. These ports can be changed, with the caveat that they need to be far apart from each other to avoid port clashes.
 
When applying to the other node, the property ìbind_addrî is the only thing that will change. The ìinitial_hostsî property will be the same for both nodes. The order and the associated ports will remain the same across all nodes.
 
Also, change propertySeparator="," to propertySeparator="::"
 
5. For liferay-multi-vm-clustered.xml, in the properties section of the replaced class, change it to this:
 
"connect=TCP(bind_port=19200;bind_addr=192.168.97.162;stats=true):TCPPING(initial_hosts=192.168.97.162[19200],192.168.97.146[17801];port_range=10;timeout=3000;num_initial_members=2;up_thread=true;down_thread=true;stats=true):VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):pbcast.GMS(join_timeout=125000;join_retry_timeout=12000;shun=false;print_local_addr=false;down_thread=true;up_thread=true;stats=true)"
 
In the above change, there are two nodes: 192.168.97.162, and 192.168.97.146. 162 is using port 19200, and 146 is using port 17801. These ports can be changed, with the caveat that they need to be far apart from each other to avoid port clashes.
 
When applying to the other node, the property ìbind_addrî is the only thing that will change. The ìinitial_hostsî property will be the same for both nodes. The order and the associated ports will remain the same across all nodes.
 
Also, change propertySeparator="," to propertySeparator="::"
 
6. In both files, comment out this class:
net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory
 
7. In both files, find this class
com.liferay.portal.cache.ehcache.LiferayCacheEventListenerFactory
and replace it with
net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory
There will be about 39 instances of this class in liferay-multi-vm-clustered.xml, and 2 in hibernate-clustered.xml.
 
8. In both files, find this class
com.liferay.portal.cache.ehcache.LiferayBootstrapCacheLoaderFactory
and replace it with
net.sf.ehcache.distribution.jgroups.JGroupsBootstrapCacheLoaderFactory
There will be about 39 instances of this class in liferay-multi-vm-clustered.xml, and 2 in hibernate-clustered.xml.
 
9. In liferay-multi-vm-clustered.xml, find this class:
com.liferay.portal.kernel.dao.orm.EntityCache
and in the corresponding properties section, change the "false" arguments to "true".
 
properties="replicatePuts=false,replicateUpdatesViaCopy=true" -> properties="replicatePuts=true,replicateUpdatesViaCopy=true"
 
10. Repeat with the other node. To revert from unicast back to multicast defaults, simply remove the two files.

Additional Information

 
Important: Information about products not created by Liferay is provided for informational purposes only and does not constitute Liferay Support recommendation nor endorsement.
这篇文章有帮助吗?
0 人中有 0 人觉得有帮助