Configuration Settings for an Apache Load-Balanced Hybris Cluster

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.

About the author

Marc is the Founder of HybrisArchitect.com. He enjoys helping others learn more about SAP Hybris Commerce. Marc has held the role of Hybris Architect at Exemplis and Nasty Gal. He is a long-time Java/Spring developer. Marc holds an M.S. Software Engineering from Carnegie Mellon University and a B.S. in Accountancy from California State University, Fresno. He can be reached at: info@hybrisarchitect.com

5 Comments

  1. Mahabir February 25, 2018 Reply
    • Marc RaygozaAuthor February 25, 2018 Reply
  2. Mahabir March 6, 2018 Reply
    • Marc RaygozaAuthor March 6, 2018 Reply
  3. adskyiproger March 13, 2018 Reply

Add a Comment

Your email address will not be published. Required fields are marked *