Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Discovery SPI > GridJgroupsDiscoverySpi
GridJgroupsDiscoverySpi
Added by user-1-ds, last edited by architect on Dec 19, 2008  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.discovery.jgroups Javadoc

Description

GridJgroupsDiscoverySpi Javadoc provides JGroups implementations of GridDiscoverySpi Javadoc SPI. It uses JGroups to discover nodes in the grid. JGroups is an opensource product that provides reliable UDP/multicast implementation among other things. You can find documentation about JGroups at JGroups Project. Note that JGroups SPI implementation uses multiplexer (re-using the same channel) since 2.0.0.

For more information on configuring JGroups see http://www.jboss.org/community/docs/DOC-11595.

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) Javadoc 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 Javadoc )
setGroupName(String) Javadoc 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 Javadoc )
setJoinTimeout(long) Javadoc Sets time limit in milliseconds to wait for responses from remote nodes. Yes 10000 milliseconds (specified by GridJgroupsDiscoverySpi.DFLT_JOIN_TIMEOUT Javadoc )

Starting from version 2.0.0 we changed and added some parameters as use JGroups multiplexer.

Setter Method Description Optional Default
setConfigurationFile(String) Javadoc 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 Javadoc )
setGroupName(String) Javadoc 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 Javadoc )
setStackName(String) Javadoc 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 Javadoc
setJoinTimeout(long) Javadoc Sets time limit in milliseconds to wait for responses from remote nodes. Yes 10000 milliseconds (specified by GridJgroupsDiscoverySpi.DFLT_JOIN_TIMEOUT Javadoc )
setMetricsFrequency(long) Javadoc 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 Javadoc )
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. We also advise you to Google search for Java IP-multicast troubleshooting on the internet as many IP-multicast intensive systems have good configuration and optimization documentations.

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.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators