4

I am trying to Implement clustering in liferay 6.2 on my local system using sticky sessions. I followed below steps to configure this.

1 install Apache Webserver and made following changes in httpd.conf

Added below code snippet at the end of file.

  <Proxy balancer://clusterdemo>
            BalancerMember ajp://localhost:8009/ route=INT1 smax=15 max=50 loadfactor=20
            BalancerMember ajp://localhost:8010/ route=INT2  smax=15 max=50 loadfactor=20
            </Proxy>

<Location / >
ProxyPass balancer://clusterdemo/ stickysession=JSESSIONID
</Location>

and uncommented below lines

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule status_module modules/mod_status.so

2 Extracted two copies of Liferay 6.2 bundle and changed the port nos accordingly

3 Changed jvmRoute in server.xml file of both Liferay tomcat bundle.

First Instance

<Engine name="Catalina" defaultHost="localhost" jvmRoute="INT1">

Second Instance

<Engine name="Catalina" defaultHost="localhost" jvmRoute="INT2  ">

4 Added below properties in portal-ext.properties file of both Liferay instance and configured same database for both instances.

cluster.link.enabled=true

cluster.link.autodetect.address=localhost:3306

5 Restarted Apache Webserver and both Liferay instance

If i hit http://127.0.0.1/web/guest/welcome url in browser i can see login page and by entering username and password i am able to login.

Problem

Now my problem is css files are not getting loaded properly as shown in below image.But with classic theme its working fine. I think its able to load css file from Liferayhome\tomcat-7.0.42\webapps\ROOT\html\themes\classic but not from Liferayhome\tomcat-7.0.42\webapps\welcome-theme any reason??/.

enter image description here

Firbug Screenshot enter image description here

Could you please help me help me in this?

**Update:**I further checked few things in browser and looking at cookie i can verify its transferring control to both instances.

Cookie:COOKIE_SUPPORT=true; JSESSIONID=48705C436A9BE3D054577705EA41FA77.INT1; GUEST_LANGUAGE_ID=en_US

Cookie:COOKIE_SUPPORT=true; JSESSIONID=C04FBBD76B10422D292827B301320DC4.INT2; GUEST_LANGUAGE_ID=en_US

Thanks in Advance

Gautam
  • 3,276
  • 4
  • 31
  • 53

2 Answers2

4

You're missing several other steps in correct Liferay clustering as well. From the top of my head,

  • Document Library
  • Search Index

are obvious missing steps. Please go through the Liferay clustering documentation and note that this is only part of the story: In Liferay's System Administration Training we'll take almost a full day to discuss all of the different clustering options. That doesn't mean that clustering takes that long - it's just that there is no single correct cluster configuration, but it all depends on the available infrastructure and expected load and use cases for your portal.

As of the missing CSS files - please monitor what replies exactly you get back from Apache/Liferay - e.g. use Firebug or similar tools to check if you get 404, 500 or others back, and what the error message is.

As of configuring sticky sessions, I'm typically configuring tomcat to indicate the server name (look up jvmRoute for server.xml) so that it automatically adds its name to the sessionid and Apache has a chance to know which tomcat created the session.

After your comments, more things to check:

  • Identify which server you're balanced to. Then access the missing resources through http - e.g. port 8080 or 8081 (or whatever that server has configured)
  • Check if this only happens when INT1 goes down but not when INT2 does (or vice versa)
  • Check if this happens when you're balanced to another server than initially (e.g. you're on INT1, take down INT1, get balanced to INT2 -> Problem? You're on INT1, take down INT2, stay on INT1 -> Problem?)
  • Make sure the AJP forwards are correct - you use localhost in your question. It's quite untypical to have two machines on the same server. If you changed this for the question, make extra extra extra sure that the hostnames are valid and do not contain typos. - and they're routable. Try nmap from the Apache host to the appservers to make sure the ports are reachable and no firewall steps in between Apache and your appserver
  • While you do all of this, keep your eyes open and don't blindly follow this advice: There's so much to pay attention to that it's impossible to list everything in this answer.

Also, this gets closer to system administration rather than programming and might be better suited for serverfault.com.

Community
  • 1
  • 1
Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • 1
    Thanks for your reply.I am aware of these changes but i didn't mentioned in my question was actually focusing on this css issue .I did check in firebug i am getting 404 for css but if I apply classic theme it works perfectly fine. Just to let you know I updated my question for jvmRoute in Step3 . Thanks in Advance. – Gautam Jan 18 '15 at 18:32
  • Have you deployed welcome-theme to both nodes? E.g. does it work on one but not on the other node? Key to this cluster installation is that both nodes must have the same plugins deployed to both of them. – Olaf Kock Jan 18 '15 at 19:50
  • yes welcome-theme is deployed on both Liferay instances. – Gautam Jan 18 '15 at 20:33
  • Thanks a lot for your suggestion will check and let you know. – Gautam Jan 20 '15 at 09:43
1

I don't know much about Liferay, but I have dabbled with Tomcat.

I'd suggest you check how ROOT and welcome-theme are configured in server.xml (and/or any context XML files).

Stephen Souness
  • 272
  • 1
  • 3