Search code examples
javagridgain

How to use gridgain with two nodes where each node on its own different host


Can anyone help me in guiding to use grid gain, The documentation on website is not enough and confusing. We have to run thousands of simulations in the LAN. can anyone help me in running compute grid on multiple hosts in a LAN. I am able to run compute example on multiple nodes on same host, but not on multiple nodes on multiple hosts. Kindly help.


Solution

  • Compute examples are configured to work with local host settings. All you have to do is update IP addresses in examples/config/example-compute.xml file to the IP addresses in your environment. You only need to provide at least 1 IP address of the node you plan to start first, but you can provide more just in case.

    Here are the configuration changes you have to make:

    <bean id="grid.cfg" class="org.gridgain.grid.GridConfiguration">
        <!-- Remove this configuration property. -->
        <!--<property name="localHost" value="127.0.0.1"/>-->
    
        ...
    
        <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
        <property name="discoverySpi">
            <bean class="org.gridgain.grid.spi.discovery.tcp.GridTcpDiscoverySpi">
                <property name="ipFinder">
                    <!-- Uncomment multicast IP finder to enable multicast-based discovery of initial nodes. -->
        <bean class="org.gridgain.grid.spi.discovery.tcp.ipfinder.multicast.GridTcpDiscoveryMulticastIpFinder">
                        <property name="addresses">
                            <list>
                                <!-- In distributed environment, replace with actual host IP address. -->
                                <value>127.0.0.1:47500..47509</value>
                            </list>
                        </property>
                    </bean>
                </property>
            </bean>
        </property>
    </bean>