28.6. Other Configuration Issues

28.6.1. Binding JGroups Channels to a Particular Interface

In the Transport Protocols section above, we briefly touched on how the interface to which JGroups will bind sockets is configured. Let us get into this topic in more depth:
First, it is important to understand that the value set in any bind_addr element in an XML configuration file will be ignored by JGroups if it finds that the system property jgroups.bind_addr (or a deprecated earlier name for the same thing, bind.address) has been set. The system property has a higher priority level than the XML property. If JBoss Enterprise Application Platform is started with the -b (or --host) switch, the application server will set jgroups.bind_addr to the specified value. If -b is not set, the application server will bind most services to localhost by default.
So, what are best practices for managing how JGroups binds to interfaces?
  • Binding JGroups to the same interface as other services. Simple, just use -b:
    ./run.sh -b 192.168.1.100 -c production
  • Binding services (e.g., JBoss Web) to one interface, but use a different one for JGroups:
    ./run.sh -b 10.0.0.100 -Djgroups.bind_addr=192.168.1.100 -c production
    Specifically setting the system property overrides the -b value. This is a common usage pattern; put client traffic on one network, with intra-cluster traffic on another.
  • Binding services (e.g., JBoss Web) to all interfaces. This can be done like this:
    ./run.sh -b 0.0.0.0 -c production
    However, doing this will not cause JGroups to bind to all interfaces! Instead, JGroups will bind to the machine's default interface. See the Transport Protocols section for how to tell JGroups to receive or send on all interfaces, if that is what you really want.
  • Binding services (e.g., JBoss Web) to all interfaces, but specify the JGroups interface:
    ./run.sh -b 0.0.0.0 -Djgroups.bind_addr=192.168.1.100 -c production
    Again, specifically setting the system property overrides the -b value.
  • Using different interfaces for different channels:
    ./run.sh -b 10.0.0.100 -Djgroups.ignore.bind_addr=true -c production
This setting tells JGroups to ignore the jgroups.bind_addr system property, and instead use whatever is specified in XML. You would need to edit the various XML configuration files to set the various bind_addr attributes to the desired interfaces.