Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liferay Clustering

I am trying to Implement clustering in liferay 6.2 using below Link

https://www.liferay.com/en_GB/documentation/liferay-portal/6.2/user-guide/-/ai/liferay-clustering-liferay-portal-6-2-user-guide-20-en

I had put below properties in both liferay server's portal-ext.properties and Pointing both Liferay server to same Database.

cluster.link.enabled=true

cluster.link.autodetect.address=localhost:3306

lucene.replicate.write=true

Now I added one portlet to a page from first Liferay instance and accessing the same page from Second Liferay instance(Using same userID) i am getting error message stating "Invalid authentication Token".It seems to be session replication problem in Cluster but not able to figure out how to resolve this.

Looking for help to figure out whats going wrong.

Thanks in Advance.

like image 1000
Liferay Beginner Avatar asked Dec 25 '22 06:12

Liferay Beginner


1 Answers

You have a severe problem in your configuration, despite the already accepted answer (which I mostly disagree with).

You'll have to set up proper clustering on Liferay. In order for Liferay to find "the other" node, it uses Multicast (by default). And if you have multiple network cards but want/need one specific network card to be used for detecting the other node, you'll give the cluster.link.autodetect.address. Liferay will use this to see which network adapter is used (by your OS) to connect to that address and then use the resulting network adapter. If you have only one adapter, the default value www.google.com:80 is good. If you set this to localhost, Liferay will try to communicate with your other node(s) on localhost, thus only succeed if you have two Liferay processes running on the same machine - otherwise you'll have no cache synchronization at all.

As of the principles of Liferay Clustering, I'd recommend to go to the User's Guide and specifically not do session replication (e.g. the tomcat-configured session replication). 95% of users don't need it, it adds significant overhead to processing, eating the performance benefits of the second server. And while you're at it: Check some common pitfalls when clustering Liferay (but beware: There are more)

Edit: To answer your "Invalid Authentication Token" question: My advice is to implement sticky sessions - e.g. balance the session creation to a certain machine, then stick to it. The Authentication token is used for mitigating CSRF attacks. Not having it implies that your session replication doesn't work correctly. As I've laid out above, I don't recommend enabling session replication, thus sticky sessions are your best option IMHO.

like image 171
Olaf Kock Avatar answered Jan 09 '23 23:01

Olaf Kock