SAP Hybris cluster : usage and limitations

What it 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.

More details here

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 choose the JGroups method !

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

clustermode =true

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

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)
cluster.id=<cluster_id_integer>
  • Automatically by autodiscovery option (5.5 SAP Hybris version and above)
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 :

Step 4: Set the JGroups’s communication protocol

  • Set the JGroupsBroadcastMethod as the communication listener between nodes,
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

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 you have change the following tomcat setting between nodes :

tomcat.http.port=9001
tomcat.ssl.port=9002
tomcat.ajp.port=9005
tomcat.jmx.port=9003
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

- By using autodiscovery, you can not exclude nodes from task execution since the id calculation is done dynamically

task.excluded.cluster.ids=14,15,16

original post : https://boufnichel.com/2018/04/23/sap-hybris-cluster-usage-and-limitations/