Click on Javadoc link to open Javadoc documentation.
Package
org.gridgain.grid.spi.discovery.multicast ![]()
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) |
Multicast IP address. | Yes | 228.1.2.4 (specified by GridMulticastDiscoverySpi.DFLT_MCAST_GROUP |
| setMulticastPort(int) |
Port number which multicast messages are sent to. | Yes | 47200 (specified by GridMulticastDiscoverySpi.DFLT_MCAST_PORT |
| setTcpPort(int) |
Local port number that is used by discovery SPI. | Yes | 47300 (specified by GridMulticastDiscoverySpi.DFLT_TCP_PORT |
| setHeartbeatFrequency(long) |
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 |
| setMaxMissedHeartbeats(int) |
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 |
| setLeaveAttempts(int) |
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 |
| setLocalAddress(String) |
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) |
Multicast messages time-to-live in router hops. | Yes | 8 (specified by GridMulticastDiscoverySpi.DFLT_TTL |
| setLocalPortRange(int) |
Local port range for TCP and Multicast ports (value must greater than or equal to 0). If provided local port (see GridMulticastDiscoverySpi.setMulticastPort(int) If port range value is 0, then implementation will try bind only to the port provided by GridMulticastDiscoverySpi.setMulticastPort(int) 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 |
| IP-multicast IP-multicast should be enabled for this SPI to function properly. We advise you to Google |
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.
