How do I switch clustering to TCP instead of multicast UDP in JBoss 5.x ?

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.x
  • Red Hat JBoss SOA Platform (SOA-P)
    • 5.x

Issue

  • We need to disable UDP transport, disable auto discovery and enable TCP to set up the clustering.
  • How do I switch clustering to TCP?
  • One node of a cluster is not joining the other two. They are linked to two different switches.

Resolution

  • Set the system property jboss.default.jgroups.stack to "tcp" to switch all default cluster channels except for JBoss Messaging to TCP:

      run.sh -Djboss.default.jgroups.stack=tcp ...
    
  • Switch the default TCP channels from multicast UDP discovery to a hard-coded server list

    • In the "tcp" stack in deploy/cluster/jgroups-channelfactory.sar/META-INF/jgroups-channelfactory-stacks.xml comment out the MPING protocol and uncomment TCPPING

    • For EAP 5.0 or 5.0.1, change jgroups.tcpping.initial_hosts to jboss.jgroups.tcp.tcpping.initial_hosts in TCPPING.initial_hosts

    • Set the system property jboss.jgroups.tcp.tcpping.initial_hosts to the list of cluster members

        run.sh -Djboss.jgroups.tcp.tcpping.initial_hosts="hostA[7600],hostB[7600]" ...
      

      Note the list of hosts needs to include all of the cluster members. For convenience the configuration can made simple by using the same list for all instances include this instance itself.

  • To switch JBoss Messaging to TCP / TCPPING, after making the above changes, change the following attributes in deploy/messaging/*-persistence-service.xml
    from:

                <attribute name="ControlChannelName">jbm-control</attribute>
                <attribute name="DataChannelName">jbm-data</attribute>
    

    to:

                <attribute name="ControlChannelName">tcp</attribute>
                <attribute name="DataChannelName">tcp</attribute>
    

Notes:

  • Make sure that the cluster instances are bound to the IP addresses specified in initial_hosts. If binding instances to 0.0.0.0, make sure to specify a jgroups.bind_addr (the same as addresses specified in initial_hosts).
  • Make sure port_range is set to 0 (defaults to 1). In some circumstances, not specifying port_range can cause intercluster communication.
  • It is recommended that num_initial_members be equal to the cluster size, but at least greater that 1/2 the cluster size.

Diagnostic Steps

It seems that you may have a multicast issue. Packaged within the JGroups library (distributed with JBoss) there is a multicast test that can be ran between nodes. Run the test numerous times, allowing each member of the cluster to be the sender and receiver.

How to test multicast using JGroups in JBoss EAP

Components
Category

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.