Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

SAP Hybris Cluster : Usage and Limitations

DZone's Guide to

SAP Hybris Cluster : Usage and Limitations

TLDR

· Performance Zone ·
Free Resource

xMatters delivers integration-driven collaboration that relays data between systems, while engaging the right people to proactively resolve issues. Read the Monitoring in a Connected Enterprise whitepaper and learn about 3 tools for resolving incidents quickly.


What is a Cluster?

In a computer system, a cluster is a group of servers (nodes) that act like a single system and enable high availability and, in some cases, load balancing and parallel processing.

Click here for more details.

How to Configure an SAP Hybris Cluster

SAP Hybris cluster can be configured in three ways:

+ JGroups communication toolkit
+ UDP multicast
+ UDP unicast

To stay simple, I have chosen the JGroups method!

Step 1: Activate the cluster mode in local.properties of each node

# enable cluster mode in the current node
clustermode =true

Step 2: Set JGroups as the communication's protocol in the SAP Hybris cluster (local.properties of each node)

# use jgroups as cluster communication method
cluster.broadcast.methods=jgroups

Step 3: Set cluster id

You can set cluster id of SAP Hybris nodes in two different ways :

  • Manually by setting cluster.id in local.properties (different value per node)
# the identifier of the cluster (integer value)
cluster.id=<cluster_id_integer>
  • Automatically by autodiscovery option (5.5 SAP Hybris version and above)
# enable auto discovery mode (introduced on the 5.5 version)
cluster.nodes.autodiscovery=true

By using the second option SAP Hybris will calculate the cluster id and save it under the table "CLNodeInfos", so if you try the following request in HAC (Hybris Administration Console)

select * from CLNodeInfos

You will get something like that :

autodiscovery_table

Step 4: Set the JGroups's communication protocol
  • Set the JGroupsBroadcastMethod as the communication listener between nodes,
# The Jgroups' hybris implementation listener
cluster.broadcast.method.jgroups=de.hybris.platform.cluster.jgroups.JGroupsBroadcastMethod

JGroupsBroadcastMethod class is the SAP Hybris' implementation of JGroups listener

  • The SAP Hybris implementation of JGroups support two transport protocols (TCP, UDP)

for TCP, you should put the following lines in your local.properties

cluster.broadcast.method.jgroups.configuration=jgroups-tcp.xml
# <node_ip> : is the ip address of the SAP hybris node
cluster.broadcast.method.jgroups.tcp.bind_addr=<node_ip>
# communication port, by defaut it is 7800 as set by SAP hybris
cluster.broadcast.method.jgroups.tcp.bind_port=7800

And for UDP (default mode)

cluster.broadcast.method.jgroups.configuration=jgroups-udp.xml
# the SAP hybris default upd multicast port
cluster.broadcast.method.jgroups.udp.mcast_port=45588

The default jgroups-udp.xml / jgroups-tcp.xml paths are

/platform/ext/core/resources/

you can set any path in the properties cluster.broadcast.method.jgroups.configuration under local.properties, for example

# The custom path of the jgroups-tcp configuration file
cluster.broadcast.method.jgroups.configuration=${HYBRIS_CONFIG_DIR}/jgroups_conf/jgroups-tcp.xml

Below an example of settings using Jgroups/TCP transport protocol/autodiscovery

cluster.broadcast.method.jgroups.tcp.bind_addr=10.13.135.89
cluster.broadcast.method.jgroups.tcp.bind_port=9999
cluster.broadcast.method.jgroups=de.hybris.platform.cluster.jgroups.JGroupsBroadcastMethod
cluster.broadcast.method.jgroups.configuration=jgroups-tcp.xml
clustermode=true
cluster.nodes.autodiscovery=true

How to configure an SAP Hybris cluster locally?

Make sure to unroll all the above steps and that the following tomcat setting was changed between nodes :

# http port 
tomcat.http.port=9001 
# https port 
tomcat.ssl.port=9002 
# ajp port 
tomcat.ajp.port=9005 
# jmx port 
tomcat.jmx.port=9003 
# jmx server port 
tomcat.jmx.server.port=9004

then run ‘ant server’ on each node under /bin/platform

ant server

Limitations

- Once autodiscovery is activated, no way to control the interval ids (for example it is not possible to start autodiscovery from the id 5 and above)

- You can have duplicated node ids by using autodiscovery due to network communication issues

3 Steps to Monitoring in a Connected Enterprise. Check out xMatters.

Topics:
sap hybris commerce ,jgroups

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}