Click on Javadoc link to open Javadoc documentation.
Package
org.gridgain.grid.spi.discovery.jgroups ![]()
Description
GridJgroupsDiscoverySpi ![]()
![]()
. Note that JGroups SPI implementation uses multiplexer (re-using the same channel) since 2.0.0.
Configuration
The following configuration parameters can be used to configure GridJgroupsDiscoverySpi
Up to version 1.6.1 configuration looks as following:
| Setter Method | Description | Optional | Default |
|---|---|---|---|
| setConfigurationFile(String) |
Sets either absolute or relative to GridGain home path to JGroups XML configuration file. | Yes | ${GRIDGAIN_HOME}/config/jgroups/jgroups_disco.xml (specified by GridJgroupsDiscoverySpi.DFLT_CONFIG_FILE |
| setGroupName(String) |
Sets JGroups group name. In order to communicate with each other, nodes must have the same group name. | Yes | grid.disco.jgroups.channel (specified by GridJgroupsDiscoverySpi.DFLT_GRP_NAME |
| setJoinTimeout(long) |
Sets time limit in milliseconds to wait for responses from remote nodes. | Yes | 10000 milliseconds (specified by GridJgroupsDiscoverySpi.DFLT_JOIN_TIMEOUT |
Starting from version 2.0.0 we changed and added some parameters as use JGroups multiplexer.
| Setter Method | Description | Optional | Default |
|---|---|---|---|
| setConfigurationFile(String) |
Sets either absolute or relative to GridGain home path to JGroups XML configuration file. | Yes | ${GRIDGAIN_HOME}/config/jgroups/multicast/jgroups.xml (specified by GridJgroupsDiscoverySpi.DFLT_CONFIG_FILE |
| setGroupName(String) |
Sets JGroups group name. In order to communicate with each other, nodes must have the same group name. | Yes | grid.disco.jgroups (specified by GridJgroupsDiscoverySpi.DFLT_GRP_NAME |
| setStackName(String) |
Sets JGroups stack name. In order to use multiplexor over the same channel SPIs must have the same stack name. Stack name is a name of configuration in the configuration file. | Yes | grid.jgroups.stack specified by GridJgroupsCommunicationSpi.DFLT_STACK_NAME |
| setJoinTimeout(long) |
Sets time limit in milliseconds to wait for responses from remote nodes. | Yes | 10000 milliseconds (specified by GridJgroupsDiscoverySpi.DFLT_JOIN_TIMEOUT |
| setMetricsFrequency(long) |
Sets delay between metrics requests. SPI sends broadcast messages in configurable time interval to other nodes to notify them about local node's metrics. | Yes | 60000 (specified by GridJgroupsDiscoverySpi.DFLT_METRICS_FREQ |
| IPv4 vs IPv6 Note, if you have an OS with IPv6 enabled, Java applications may try to route IP multicast traffic over IPv6. Use "-Djava.net.preferIPv4Stack=true" system property at VM startup to prevent this. You may also wish to specify local bind address in JGroups configuration file to make sure that JGroups binds to correct network interface. |
| JGroups and Linux We had a number of issues with configuring JGroups on Linux (mostly with getting IP multicast to work). We highly recommend to consult JGroups documentation |
Examples
GridJgroupsDiscoverySpi needs to be explicitely configured to override default Multicast discovery SPI.
GridJgroupsDiscoverySpi spi = new GridJgroupsDiscoverySpi(); // Override default JGroups configuration file. spi.setConfigurationFile("/my/config/path/jgroups.xml"); GridConfigurationAdapter cfg = new GridConfigurationAdapter(); // Override default discovery SPI. cfg.setDiscoverySpi(spi); // Start grid. GridFactory.start(cfg);
or from Spring configuration file
<bean id="grid.custom.cfg" class="org.gridgain.grid.GridConfigurationAdapter" singleton="true"> ... <property name="discoverySpi"> <bean class="org.gridgain.grid.spi.discovery.jgroups.GridJgroupsDiscoverySpi"> <property name="configurationFile" value="/my/config/path/jgroups.xml"/> </bean> </property> ... </bean>

For more information about using Spring framework for configuration click here.
