JGroups Protocol RELAY2

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

External

Internal

Overview

RELAY2 protocol was introduced to allow relaying (bridging) messages between two or more clusters.

The relaying mechanism works by establishing a "bridging cluster" between the participating local clusters. Each local cluster is "represented" in the bridging cluster by its coordinator, which is the only node in the local cluster that forwards messages to the coordinators of other clusters participating in the relaying process. The only members of the bridging cluster are the local group coordinators. A message sent to the bridging cluster reaches all its member, hence all participating clusters.

For two local clusters ("blue" and "red"), relaying works in both directions: messages passing between the members of cluster "blue" will be forwarded to cluster "red", eventually reaching all its members, while messages passing between the members of the cluster "red" will be forwarded to the cluster "blue"

The relaying mechanism is implemented at JGroups level by adding a RELAY2 protocol at the top of the stack. The RELAY2 protocol instantiates and starts a new JGroups channel, which is used to join the bridging cluster. Thus, the coordinator instance will run two parallel JGroups stacks. The bridging clusters typically use the TCP transport.

In case a local coordinator dies, the next local member takes over as coordinator, joins the bridging cluster in the process, and continues relaying messages.

The site Property

The RELAY2 site property must be set consistently on all members of a local cluster:

<relay.RELAY2 site="blue" config=".../relay2.xml" relay_multicasts="false"/>

Configuration

This is an example of how to configure two Infinispan clusters to relay to each other:

Bridge Two Infinsipan Clustered Caches with RELAY2