How do I switch clustering to TCP instead of multicast UDP in JBoss Data Grid

Solution Unverified - Updated -

Environment

  • Red Hat JBoss Data Grid (JDG)
    • 6.x
    • 7.x

Issue

  • How does one switch clustering to TCP from UDP in JBoss Data Grid?
  • Can JBoss Data Grid be configured to use TCP-based clusters?

Resolution

If using JDG in client server mode:

  • Within the jgroups subsystem of the clustered.xml configuration change ${jboss.default.jgroups.stack:udp} to ${jboss.default.jgroups.stack:tcp}. Alternatively, one can pass in -Djboss.default.jgroups.stack=tcp at startup.

  • From the tcp stack, remove the MPING (UPD-based discovery) protocol, replacing it with TCPPING(TCP-based discovery) like such:

    <protocol type="TCPPING">
        <property name="initial_hosts">10.10.10.10[7600],20.20.20.20[7600]</property>
        <property name="num_initial_members">2</property>
        <property name="port_range">0</property>
        <property name="timeout">2000</property>
    </protocol>

If using JDG in library mode (see the example default-configs/default-jgroups-tcp.xml file distributed inside infinispan-embedded-*.jar):

  • Set the desired bind address (use the IP address that will be listed in the initial_hosts configuration below):
<TCP bind_addr="${jgroups.tcp.address:10.10.10.10}"
     bind_port="${jgroups.tcp.port:7800}"
...
  • Replace MPING in that configuration with TCPPING:
    <TCPPING timeout="2000"
        initial_hosts="10.10.10.10[7800],20.20.20.20[7800]"
        port_range="0"
        num_initial_members="2"/>

Notes:
-initial_hosts is a listing of all members of the cluster and should be the same on every node.
- port_range should be set to 0.
- num_initial_members should be equal to the total number of members within the cluster.

  • For JDG 7.1 (and beyond), use the below TCPPING configuration :
<protocol type="TCPPING">
    <property name="initial_hosts">10.10.10.10[7600],20.20.20.20[7600]</property>
 </protocol>

NOTE : From JDG 7.1 num_initial_members and timeout property will not work. Red Hat JBoss Data Grid 7.1 uses JGroups 4.0.0.CR2, in which the TCPPING timeout value no longer exists. Use the pbcast.GMS join_timeout value to indicate the timeout period instead.

ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.jgroups.channel.cluster: org.jboss.msc.service.StartException in service jboss.jgroups.channel.cluster: java.lang.IllegalArgumentException: JGRP000001: configuration error: the following properties in org.jgroups.protocols.TCPPING are not recognized: {num_initial_members=2, timeout=2000}
  • pbcast.GMS join_timeout can be used instead of timeout in JDG 7.1

Refer to TCP Default and Recommended Values for more information.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments