Dashboard > GridGain User Guide > Table Of Contents > Developers Guide > Discovery SPI > GridMulticastDiscoverySpi
GridMulticastDiscoverySpi
Added by user-1-ds, last edited by morpheus on Jul 31, 2007  (view change)
Labels: 
(None)


Click on Javadoc link to open Javadoc documentation.

Package

org.gridgain.grid.spi.discovery.multicast Javadoc

Description

Discovery SPI implementation using IP-multicast.

Configuration

The following configuration parameters can be used to configure GridMulticastDiscoverySpi:

Setter Method Description Optional Default
setMulticastGroup(String) Javadoc Multicast IP address. Yes 228.1.2.4 (specified by GridMulticastDiscoverySpi.DFLT_MCAST_GROUP Javadoc )
setMulticastPort(int) Javadoc Port number which multicast messages are sent to. Yes 47200 (specified by GridMulticastDiscoverySpi.DFLT_MCAST_PORT Javadoc )
setTcpPort(int) Javadoc Local port number that is used by discovery SPI. Yes 47300 (specified by GridMulticastDiscoverySpi.DFLT_TCP_PORT Javadoc )
setHeartbeatFrequency(long) Javadoc Delay in milliseconds between heartbeat requests. SPI sends Multicast messages in configurable time interval to other nodes to notify them about its state. Yes 5000 (specified by GridMulticastDiscoverySpi.DFLT_HEARTBEAT_FREQ Javadoc )
setMaxMissedHeartbeats(int) Javadoc Number of heartbeat requests that could be missed before remote node is considered to be failed. Yes 3 (specified by GridMulticastDiscoverySpi.DFLT_MAX_MISSED_HEARTBEATS Javadoc )
setLeaveAttempts(int) Javadoc Number of attempts to notify another nodes that this one is leaving grid. Multiple leave requests are sent to increase the chance of successful delivery to every node, since IP Multicast protocol is unreliable. Note that on most networks loss of IP Multicast packets is generally negligible.. Yes 3 (specified by GridMulticastDiscoverySpi.DFLT_LEAVE_ATTEMPTS Javadoc )
setLocalAddress(String) Javadoc Local host IP address that discovery SPI uses. Yes Local host address. Preference will be given to none-loopback address if one can be detected. Otherwise, loopback address will be assigned.
setTimeToLive(int) Javadoc Multicast messages time-to-live in router hops. Yes 8 (specified by GridMulticastDiscoverySpi.DFLT_TTL Javadoc )
setLocalPortRange(int) Javadoc Local port range for TCP and Multicast ports (value must greater than or equal to 0). If provided local port (see GridMulticastDiscoverySpi.setMulticastPort(int) Javadoc or GridMulticastDiscoverySpi.setTcpPort(int) Javadoc is occupied, implementation will try to increment the port number for as long as it is less than initial value plus this range.
If port range value is 0, then implementation will try bind only to the port provided by GridMulticastDiscoverySpi.setMulticastPort(int) Javadoc or GridMulticastDiscoverySpi.setTcpPort(int) Javadoc methods and fail if binding to these ports did not succeed.
Local port range is very useful during development when more than one grid nodes need to run on the same physical machine
Yes 10 (specified by GridMulticastDiscoverySpi.DFLT_PORT_RANGE Javadoc )
IP-multicast

IP-multicast should be enabled for this SPI to function properly. We 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

GridMulticastDiscoverySpi is used by default and should be explicitely configured only if some SPI configuration parameters need to be overriden. Examples below insert own multicast group value that differs from default 228.1.2.4.

GridMulticastDiscoverySpi spi = new GridMulticastDiscoverySpi();

// Put another multicast group.
spi.setMulticastGroup("228.10.10.157");

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.multicast.GridMulticastDiscoverySpi">
                <property name="multicastGroup" value="228.10.10.157"/>
            </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