-
Language:
English
-
Language:
English
23.3.2. Configure Cross-Datacentre Replication (Library Mode)
When configuring Cross-Datacentre Replication, the
relay.RELAY2
protocol creates an additional stack (running parallel to the existing TCP
stack) to communicate with the remote site. If a TCP
-based stack is used for the local cluster, two TCP
based stack configurations are required: one for local communication and one to connect to the remote site.
In Red Hat JBoss Data Grid's Library mode, cross-datacentre replication is set up as follows:
Procedure 23.2. Configure Cross-Datacentre Replication (Library Mode)
Configure the Local Site
- Add the
site
element to theglobal
element to add the local site (in this example, the local site is namedLON
).<infinispan> <global> ... <site local="LON" /> ... </global> </infinispan>
- Cross-site replication requires a non-default JGroups configuration. Add the
transport
element and set up the path to the configuration file as theconfigurationFile
property. In this example, the JGroups configuration file is namedjgroups-with-relay.xml
.<infinispan> <global> ... <site local="LON" /> <transport clusterName="default"> <properties> <property name="configurationFile" value="jgroups-with-relay.xml" /> </properties> </transport> ... </global> </infinispan>
Add the Contents of the Configuration File
As a default, Red Hat JBoss Data Grid includes JGroups configuration files such asjgroups-tcp.xml
andjgroups-udp.xml
in theinfinispan-core-{VERSION}.jar
package.Copy the JGroups configuration to a new file (in this example, it is namedjgroups-with-relay.xml
) and add the provided configuration information to this file. Note that therelay.RELAY2
protocol configuration must be the last protocol in the configuration stack.<config> ... <relay.RELAY2 site="LON" config="relay.xml" can_become_site_master="true" max_site_masters="1"/> </config>>
Configure the relay.xml File
Set up therelay.RELAY2
configuration in therelay.xml
file. This file describes the global cluster configuration.<RelayConfiguration> <sites> <site name="LON" id="0"> <bridges> <bridge config="jgroups-global.xml" name="global"/> </bridges> </site> <site name="NYC" id="1"> <bridges> <bridge config="jgroups-global.xml" name="global"/> </bridges> </site> <site name="SFO" id="2"> <bridges> <bridge config="jgroups-global.xml" name="global"/> </bridges> </site> </sites> </RelayConfiguration>
Configure the Global Cluster
The filejgroups-global.xml
referenced inrelay.xml
contains another JGroups configuration which is used for the global cluster: communication between sites.The global cluster configuration is usuallyTCP
-based and uses theTCPPING
protocol (instead ofPING
orMPING
) to discover members. Copy the contents ofjgroups-tcp.xml
intojgroups-global.xml
and add the following configuration in order to configureTCPPING
:<config> <TCP bind_port="7800" ... /> <TCPPING initial_hosts="lon.hostname[7800],nyc.hostname[7800],sfo.hostname[7800]" num_initial_members="3" ergonomics="false" /> <!-- Rest of the protocols --> </config>
Replace the hostnames (or IP addresses) inTCPPING.initial_hosts
with those used for your site masters. The ports (7800
in this example) must match theTCP.bind_port
.File Locations
Ensure all the created files are on the classpath before using the new configurations.