[id='configuring-cluster-transport-cross-site_{context}']
= Configuring cluster transport for cross-site replication

Add JGroups `RELAY2` protocol to your transport layer so that {brandname} can replicate caches to the backup locations.

.Procedure

. Open your {brandname} configuration for editing.
. Add the `RELAY2` protocol to a JGroups stack.
. Specify the stack name with the `stack` attribute for the transport configuration so the {brandname} cluster uses it.
. Save and close your {brandname} configuration.

[discrete]
== JGroups RELAY2 stacks

The following configuration shows a JGroups RELAY2 stack that:

* Uses the default JGroups UDP stack for inter-cluster transport, which refers to communication between nodes at the local site.
* Uses the default JGroups TCP stack for cross-site replication traffic.
* Names the local site as **LON**.
* Specifies a maximum of 1000 nodes in the cluster that can send cross-site replication requests.
* Specifies the names of all backup locations that participate in cross-site replication.

.XML
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::xml/jgroups_relay.xml[]
----

.JSON
[source,json,options="nowrap",subs=attributes+,role="secondary"]
----
include::json/jgroups_relay.json[]
----

.YAML
[source,yaml,options="nowrap",subs=attributes+,role="secondary"]
----
include::yaml/jgroups_relay.yaml[]
----

<1> Change the default port to 7900 to avoid conflict with the cluster communication.
<2> Replaces discovery `MPING` (only works with IP multicast, not available between networks) with `TCPPING`.
`TCPPING` requires a comma separated list of hosts using the format `ip[port]`.
Other discovery protocols may be used depending on the architecture.
<3> In `RELAY2`, configure the local site name (`site` attribute) and the number of relay nodes (`max_site_masters` attribute).
<4> Sets the stack (`default-stack` attribute) to use for the cross-site communication.
<5> Sets the stack to use by {brandname} (`stack` attribute).

[role="_additional-resources"]
.Additional resources
* link:#ref_relay-xsite[JGroups RELAY2 Stacks]
* link:../../configuration-schema/index.html[{brandname} configuration schema reference]
