This tutorial demonstrates the configuration details for a two node, load-balanced Hybris cluster using Apache Web Server.

 

Steps

Step 1

Configure Node1’s local.properties file to resemble the following:

yacceleratorstorefront.webroot=
storefrontContextRoot=
#Cluster
clustermode=true
cluster.id=1
cluster.maxid=2
cluster.broadcast.methods=jgroups
cluster.broadcast.method.jgroups=de.hybris.platform.cluster.jgroups.JGroupsBroadcastMethod
cluster.broadcast.method.jgroups.tcp.bind_addr=127.0.0.1
cluster.broadcast.method.jgroups.tcp.bind_port=7800
cluster.broadcast.method.jgroups.channel.name=hybris-broadcast
cluster.broadcast.method.jgroups.configuration=jgroups-tcp.xml
cluster.broadcast.method.udp.multicastaddress=230.0.0.1
cluster.broadcast.method.udp.port=9997
log4j.logger.de.hybris.platform.cluster.PingBroadcastHandler=DEBUG
log4j.logger.de.hybris.platform.cluster.udp.UnicastBroadcastMethod=DEBUG

 

Step 2

Configure Node2’s local.properties file to resemble the following:

yacceleratorstorefront.webroot=
storefrontContextRoot=
 
#Cluster
clustermode=true
cluster.id=2
cluster.maxid=2
cluster.broadcast.methods=jgroups
cluster.broadcast.method.jgroups=de.hybris.platform.cluster.jgroups.JGroupsBroadcastMethod
cluster.broadcast.method.jgroups.tcp.bind_addr=127.0.0.1
cluster.broadcast.method.jgroups.tcp.bind_port=7800
cluster.broadcast.method.jgroups.channel.name=hybris-broadcast
cluster.broadcast.method.jgroups.configuration=jgroups-tcp.xml
cluster.broadcast.method.udp.multicastaddress=230.0.0.1
cluster.broadcast.method.udp.port=9997
log4j.logger.de.hybris.platform.cluster.PingBroadcastHandler=DEBUG
log4j.logger.de.hybris.platform.cluster.udp.UnicastBroadcastMethod=DEBUG
tomcat.http.port=10001
tomcat.ssl.port=10002
tomcat.ajp.port=10009
tomcat.ajp.ssl.port=10010
tomcat.jmx.port=10003
tomcat.jmx.server.port=10004

 

Step 3

Edit the Apache Web Server httpd.conf file to include the following:

Header add Set-Cookie: "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
 
<Proxy balancer://mycluster>
BalancerMember http://127.0.0.1:9001 route=node1
BalancerMember http://127.0.0.1:10001 route=node2
</Proxy>
 
ProxyPass / balancer://mycluster/ stickysession=ROUTEID
ProxyPassReverse / balancer://mycluster/
 
<Location /balancer-manager>
SetHandler balancer-manager
 
Order Deny,Allow
Deny from all
Allow from all
</Location>
For my information on load balancing with Apache: https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html

*This article was inspired by a previous article written by John B. from Hybris.

Similar Posts