Liferay clustering checklist

April 21st 2011

Yesterday our team finished clustering of our Liferay portal environment. In case I have to do this again, I decided to write a small checklist what should be taken into a consideration when clustering. Official Liferay clustering guide can be found here.

Updates to blog post

How to do it?

  1. Ensure that you have same JRE/JDK on both cluster nodes.
  2. Check that all Liferay nodes can access your database (or database cluster) and it allows connections from these hosts.
  3. Ensure that load balancer can forward requests to both nodes and firewalls won't block access.
  4. Check that all of  cluster nodes are able to send email using your configured SMTP server (e.g. with telnet).
  5. Install same version of Liferay to all cluster nodes.
  6. If you need session fail over, configure that.
  7. Configure tomcat connectors "secure" and "unsecure" to use ajp protocol like so: <Connector address="xx.xx.xx.xx" port="8009" protocol="AJP/1.3" ... > <Connector address="xx.xx.xx.xx" port="8443" protocol="AJP/1.3" ... >
  8. Configure properties "net.sf.ehcache.configurationResourceName" and "ehcache.multi.vm.config.location" correctly to portal-ext.properties.
  9. Move your Lucene index to database or if that is not possible, to shared NFS mount. In case of shared NFS mount, linux UIDs for Liferay user must be equal in all nodes so that Linux file permissions work correctly.  Liferay user must be able to write to Lucene directory.
  10. Move your document library to shared NFS mount or to database. Same rules apply as above.
  11. Ensure that your configured Lucene index and document library paths point to correct location in portal-ext.properties.
  12. Start your cluster nodes.
  13. Check that modproxyajp module is loaded by apache.
  14. Configure Apache  load balancer like so: Proxy balancers:

<Proxy balancer://liferaycluster> BalancerMember ajp://node1:8009 route=node1 ping=5 loadfactor=1 BalancerMember ajp://node2:8009 route=node2 ping=5 loadfactor=1 ProxySet stickysession=ROUTEID </Proxy>

<Proxy balancer://secureliferaycluster> BalancerMember ajp://node1:8443 route=node1 ping=5 loadfactor=1 BalancerMember ajp://node2:8443 route=node2 ping=5 loadfactor=1 ProxySet stickysession=ROUTEID </Proxy>

This inside your :80 virtual host:

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED ProxyPass /group balancer://secureliferaycluster/group/ ProxyPassReverse /group balancer://secureliferaycluster/group/ ProxyPass / balancer://liferaycluster/ ProxyPassReverse / balancer://liferaycluster/

This inside your :443 virtual host:

ProxyPass /group balancer://secureliferaycluster/group/ ProxyPassReverse /group balancer://secureliferaycluster/group/ ProxyPass / balancer://liferaycluster/ ProxyPassReverse / balancer://liferaycluster/

That's it!

What's next?

Did you know that I provide software development consulting services? Check out how I can help you.

« Back to blog

Discussion