Section 23.1.2, “Transport Protocols” briefly described the interface to which JGroups binds sockets. Read this section to understand how to configure this interface.
The value set in any
bind_addr element in an XML configuration file is ignored by JGroups if the jgroups.bind_addr (or deprecated bind.address system property is already set. The system property will always override the XML configuration. The -b (or --host) switch is used to set the jgroups.bind_addr system property at server startup.
By default, JBoss Enterprise Web Platform binds most services to the local host if the
-b switch is not set. Therefore, most users need to set -b, and any XML configuration will be ignored.
So, what are best practices for managing how JGroups binds to interfaces?
- Bind JGroups to the same interface as other services
- Use the
-bswitch, like so:./run.sh -b 192.168.1.100 -c production
- Bind services to one interface and JGroups to another
- Specifically setting the system property with
-Doverrides the value specified by-b:./run.sh -b 10.0.0.100 -Djgroups.bind_addr=192.168.1.100 -c production
The code here is a common usage pattern. It places client traffic on one network and intra-cluster traffic on another. - Bind services to all interfaces
- Bind services to all interfaces with the following command on startup:
./run.sh -b 0.0.0.0 -c production
This will not bind JGroups to all interfaces
JGroups will bind to the machine's default interface. See Section 23.1.2, “Transport Protocols” to learn how to tell JGroups to send and receive on all interfaces. - Bind services to all interfaces and specify a JGroups interface
- Specifically setting the system property with
-Doverrides the value specified by-b:./run.sh -b 0.0.0.0 -Djgroups.bind_addr=192.168.1.100 -c production
- Use different interfaces for different channels
- Set the
jgroups.ignore.bind_addrproperty totrueon server startup, like so:./run.sh -b 10.0.0.100 -Djgroups.ignore.bind_addr=true -c production
This setting tells JGroups to ignore thejgroups.bind_addrsystem property and use the value specified in the XML. You would then edit the XML configuration files to specify thebind_addrto the desired interface.