How to configure Red Hat JBoss Data Grid to bind a specific interface for REST APIs and Hot Rod clients?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Data Grid (JDG)
    • 7.3.x

Issue

  • How to configure Red Hat JBoss Data Grid to bind a specific interface for REST APIs?
  • How to configure Red Hat JBoss Data Grid to bind a specific interface for Hot Rod clients?
  • How to configure Red Hat JBoss Data Grid using two network interfaces?
  • How to configure Red Hat JBoss Data Grid communication in additional network interface?

Resolution

  1. Add a multicast route to the additional interface used for cluster communications like Hot Rod clients and API's for services.

        ip route add 224.0.0.0/4 dev eth1
    
    • To see the routing table use ip route show command.
       default via 192.168.100.1 dev eth0 proto static metric 100 
       192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.100.10 metric 100 
       192.168.111.0/24 dev eth1 proto kernel scope link src 192.168.111.10 metric 101 
       224.0.0.0/4 dev eth1 scope link 
    
    • Note that routes configurations must be made and fixed in a persistent way in all nodes of the cluster in the network interface startup files.
    • To configure in a persistent way in Red Hat Enterprise Linux 7, see the RHEL 7 documentation
  2. Configure the name resolution for the cluster traffic on additional network interface in /etc/hosts file.

    # /etc/hosts example file.
    #
    # Hot Rod clients connections on eth0 interface are using DNS resolution set by network administrator on 192.168.100.0/24 network DNS Server.
    #
    # Cluster traffic name resolution for Multicast and REST API's using eth1
    192.168.111.10 node01.example.com node01
    192.168.111.20 node02.example.com node02
    192.168.111.30 node03.example.com node03
    
  3. Add a new interface configuration to the <interfaces> section into clustered.xml file, the configuration should be such as:

        <interface name="jgroups-additional">
            <inet-address value="${jboss.bind.address.jgroups:127.0.0.1}"></inet-address>
        </interface>
    
  4. Configure the additional IP address either in that section, or with the system property jboss.bind.address.jgroups, or with -bjgroups=1.2.3.4 on startup.

  5. Change the <socket-binding> for JGroups to refer to that new interface.

        <socket-binding name="jgroups-tcp" interface="jgroups-additional" port="7600"></socket-binding>
        <socket-binding name="jgroups-tcp-fd" interface="jgroups-additional" port="57600"></socket-binding>
        <socket-binding name="jgroups-udp" interface="jgroups-additional" port="55200" multicast-address="${jboss.default.multicast.address:234.99.54.14}" multicast-port="45688"></socket-binding>
        <socket-binding name="jgroups-udp-fd" interface="jgroups-additional" port="54200"></socket-binding>
    

Root Cause

Setting jboss.bind.address.jgroups in clustered.xml file makes Red Hat Data Grid cluster start all services and API's only on the default network interface address.

Diagnostic Steps

As root user, enter ss -patn command on any configured cluster node to see the listening addresses and ports. Note a listening port 11222 to the Hot Rod client and a listening port 8080 to the web-service API's.

State      Recv-Q Send-Q          Local Address:Port                         Peer Address:Port              
LISTEN     0      128                 127.0.0.1:5900                                    *:*                  
LISTEN     0      128                 127.0.0.1:5901                                    *:*                  
LISTEN     0      128                 127.0.0.1:5902                                    *:*                  
LISTEN     0      128                         *:111                                     *:*                  
LISTEN     0      5               192.168.111.1:8080                                    *:*                  
LISTEN     0      5               192.168.111.1:9443                                    *:*                  
LISTEN     0      5               192.168.100.1:11222                                   *:*                  
LISTEN     0      50                  127.0.0.1:37174                                   *:*   

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