Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sandeep Nair
Liferay Clustered Environment
December 15, 2010 12:02 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

Hi,

I have a requirement that i setup a clustered env which has 2 apache web servers load balanced, 2 Liferay instances(Tomcat bundle) clustered and 2 database servers

I have previously tried setting up clustered environment which has two tomcats and 1 apache web server.

Can anyone plz suggest me what to do to have my clustered environment setup. I want to do this all in my local machine first. So is it possible to have two apache web servers running on same box and how to make them load balanced. It would be awesome if someone mentioned the exact steps to do in local than pointing to some google link, (i dont mind google links as long as they have exact steps that i can follow to achieve the above).

Regards,
Sandeep
Olaf Kock
RE: Liferay Clustered Environment
December 15, 2010 7:38 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: September 23, 2008

Recent Posts

Are you sure you need this duplication on all levels? Usually there's a single layer that requires more performance than the others.

Running two apaches with two tomcats (liferays): Should each Apache loadbalance to both tomcats or is it supporse to be frontend to only one tomcat? However - it shouldn't make a big difference compared to the known configuration with tomcat either way. The loadbalancer would probably be sepate though (in front of the Apaches)

Database clustering and how you best do that depends a lot on your database (and your budget). From Liferay's point of view a DB cluster should (ideally) appear as a single database.

Other than (your need to) answering these two questions I can't see more things to apapt to the current standard clustering approach - at least not immediately without doing it myself.
Sandeep Nair
RE: Liferay Clustered Environment
December 15, 2010 9:24 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

Thanks Olaf for reply.

DB clustering i can manage. i will configure one db for write and one db for read and write.

Yes apache is the pain here. The client wants two apaches for High availability and failover. So if one web server fails they want the second to handle things and yes they would want to utilize two web server for loadbalancing to each available instance of tomcat.

Regards,
Sandeep
Syed Mudassir Ali
RE: Liferay Clustered Environment
December 15, 2010 10:32 PM
Answer

Syed Mudassir Ali

Rank: New Member

Posts: 10

Join Date: November 29, 2010

Recent Posts

Hi
Iam using tomcat bundled with liferay 6.0.5 in a clusttered environment.and trying to cache serializable objects with MultiVMPoolUtil (EHCache).

To my surprise i was able to replicate String,ArrayList put in cache in second server but, serializable objects put in cache donot get replicated in second server.

Your help will be appreciated.
Thanks in Advance.
Sandeep Nair
RE: Liferay Clustered Environment
December 15, 2010 11:45 PM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

Hi Olaf,

I was able to set up a clustered load balanced environment in my local. It has one database, two tomcat and one apache.

Here are the properties that i added in portal-ext.properties
 1jdbc.default.driverClassName=com.mysql.jdbc.Driver
 2jdbc.default.url=jdbc:mysql://localhost/cluster_write?useUnicode=true&characterEncoding=UTF8&useFastDateParsing=false
 3jdbc.default.username=root
 4jdbc.default.password=root
 5
 6#Ehcache
 7net.sf.ehcache.configurationResourceName=/ehcache/hibernate-clustered.xml
 8ehcache.multi.vm.config.location=/ehcache/liferay-multi-vm-clustered.xml
 9
10#documentlibrary
11dl.hook.impl=com.liferay.documentlibrary.util.AdvancedFileSystemHook
12image.hook.impl=com.liferay.portal.image.DLHook
13
14image.hook.file.system.root.dir=E:/Practice/Liferay/clusterTesting/data/images
15dl.hook.file.system.root.dir=E:/Practice/Liferay/clusterTesting/data/document_library
16
17lucene.dir=E:/Practice/Liferay/clusterTesting/data/lucene/
18#cluster.link.enabled=true
19#web.server.display.node=true


For apache I enabled following

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

And in httpd-vhosts.conf added the following

 1<VirtualHost *:80>
 2    ServerName node1.liferay.com
 3    ErrorLog logs/ajperror.log
 4    CustomLog logs/ajp.log combined
 5   
 6    <Proxy *>
 7        AddDefaultCharSet Off
 8        Order deny,allow
 9        Allow from all
10    </Proxy>
11    ProxyPass /balancer-manager !
12    ProxyPass / balancer://ajpCluster/ stickysession=JSESSIONID
13    ProxyPassReverse / balancer://ajpCluster/ stickysession=JSESSIONID
14    <Proxy balancer://ajpCluster>
15        BalancerMember ajp://localhost:8009 route=lr1
16        BalancerMember ajp://localhost:9009 route=lr2
17        ProxySet lbmethod=byrequests
18    </Proxy>
19   
20    <Location /balancer-manager>
21        SetHandler balancer-manager
22        Order deny,allow
23        Allow from all
24    </Location>
25</VirtualHost>


It works fine but i have some questions to you

1) How to add another apache?
2) I tried to make database in read write mode by putting the following but it tried to put data in write database and for read it was trying to use hypersonic. Is it becoz that i havent enabled replication first that it happend that way?

 1spring.configs=\
 2        META-INF/base-spring.xml,\
 3        \
 4        META-INF/hibernate-spring.xml,\
 5        META-INF/infrastructure-spring.xml,\
 6        META-INF/management-spring.xml,\
 7        \
 8        META-INF/util-spring.xml,\
 9        \
10        META-INF/jpa-spring.xml,\
11        \
12        META-INF/audit-spring.xml,\
13        META-INF/cluster-spring.xml,\
14        META-INF/editor-spring.xml,\
15        META-INF/jcr-spring.xml,\
16        META-INF/ldap-spring.xml,\
17        META-INF/messaging-core-spring.xml,\
18        META-INF/messaging-misc-spring.xml,\
19        META-INF/poller-spring.xml,\
20        META-INF/rules-spring.xml,\
21        META-INF/scheduler-spring.xml,\
22        META-INF/scripting-spring.xml,\
23        META-INF/search-spring.xml,\
24        META-INF/workflow-spring.xml,\
25        \
26        META-INF/counter-spring.xml,\
27        META-INF/document-library-spring.xml,\
28        META-INF/mail-spring.xml,\
29        META-INF/portal-spring.xml,\
30        META-INF/portlet-container-spring.xml,\
31        \
32        META-INF/dynamic-data-source-spring.xml,\
33        #META-INF/shard-data-source-spring.xml,\
34        #META-INF/memcached-spring.xml,\
35        #META-INF/monitoring-spring.xml,\
36        \
37        META-INF/ext-spring.xml
38
39jdbc.read.driverClassName=com.mysql.jdbc.Driver
40jdbc.read.url=jdbc:mysql://localhost/cluster_read?useUnicode=true&characterEncoding=UTF8&useFastDateParsing=false
41jdbc.read.username=root
42jdbc.read.password=root
43
44jdbc.write.driverClassName=com.mysql.jdbc.Driver
45jdbc.write.url=jdbc:mysql://localhost/cluster_write?useUnicode=true&characterEncoding=UTF8&useFastDateParsing=false
46jdbc.write.username=root
47jdbc.write.password=root


4) we will be using SAN for file storage. Is it advisable to use cluster link for lucene or can i use SAN for the same? If i go for cluster link, will just setting cluster.link.enabled to true, make it start working or do i need to do some more change.

5) While using SAN for example in my case above the following should work rright?

dl.hook.file.system.root.dir=//SAN_IP/cluster/data/document_library
Olaf Kock
RE: Liferay Clustered Environment
December 16, 2010 3:07 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: September 23, 2008

Recent Posts

Sandeep Nair:
Hi Olaf,

I was able to set up a clustered load balanced environment in my local. It has one database, two tomcat and one apache.

...

It works fine but i have some questions to you

1) How to add another apache?


I would expect a second apache to be added exactly the same way. I wouldn't expect that there are any problems with tomcat when there are more apaches in front. It's ok when there are a lot of clients for a webserver - so it should be with the proxy. I've never done this, but this is my expectation. Have you tried it and ran into specific problems?

Sandeep Nair:

2) I tried to make database in read write mode by putting the following but it tried to put data in write database and for read it was trying to use hypersonic. Is it becoz that i havent enabled replication first that it happend that way?


I don't really understand what you're saying here. Write to mysql and read from hsql? Please check if your properties configuring this access are correct and if you got all steps. This is in the admin documentation (I believe). I'd have to look it up just as you do.

Sandeep Nair:

4) we will be using SAN for file storage. Is it advisable to use cluster link for lucene or can i use SAN for the same? If i go for cluster link, will just setting cluster.link.enabled to true, make it start working or do i need to do some more change.


There's a lot of options. If you're on 5.2.x, the property is enough. On 6.0.x you need one more property, as clusterlink is now used for more than just indexing-clusters: lucene.replicate.write=true

Please read the admin documetation on the alternatives. ClusterLink is easy to set up, but requires re-indexing once you bring a server online, as every server has its own index. If you can live with this, it's fine, but you have to know this.

Sandeep Nair:

5) While using SAN for example in my case above the following should work rright?

dl.hook.file.system.root.dir=//SAN_IP/cluster/data/document_library


I'd expect it to work - somebody else should comment if it doesn't. I'm a bad SAN reference. However, placing documentlibrary on a SAN is recommended.
While you're at it: Remember ImageGallery
Sandeep Nair
RE: Liferay Clustered Environment
December 17, 2010 6:39 AM
Answer

Sandeep Nair

Rank: Liferay Legend

Posts: 1692

Join Date: November 5, 2008

Recent Posts

Hi Olaf,

Thanks for the reply. What i wanted to say for database was. I set the properties that need to be set up for read write config, and have 2 databases created in mysql for writing and reading and mentioned those in portal-ext.properties.

Now what happens when i start liferay up is it populates the the database that is configured for write in Mysql and then it starts to throw up exceptions for database that is configured for read and then start Hypersonic database by default. Is it because i havent configured replication in database before doing this?

Regards,
Sandeep
Sreeraj AV
RE: Liferay Clustered Environment
January 17, 2013 5:50 AM
Answer

Sreeraj AV

Rank: Regular Member

Posts: 233

Join Date: April 26, 2010

Recent Posts

Sandeep Nair:
Hi Olaf,

Thanks for the reply. What i wanted to say for database was. I set the properties that need to be set up for read write config, and have 2 databases created in mysql for writing and reading and mentioned those in portal-ext.properties.

Now what happens when i start liferay up is it populates the the database that is configured for write in Mysql and then it starts to throw up exceptions for database that is configured for read and then start Hypersonic database by default. Is it because i havent configured replication in database before doing this?

Regards,
Sandeep



can u please explain how you configured two apache web servers ? I have 4 machines, 2 for tomcat severs and 2 for apache web servers.