Search code examples
javascalaignite

Ignition.ignite returns "Grid instance was not properly started or was already stopped"


I have a two node Apache Ignite cluster up but when I call Ignition.ignite from the scala shell or a java program running on any of the machines I get:

org.apache.ignite.IgniteIllegalStateException: Grid instance was not properly started or was already stopped: null

I have tried naming the cluster in default-config.xml:

<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="gridName" value="grid"/>
</bean>

but that didn't work. The nodes were started using ignite.sh and can see that they started OK.

Topology snapshot [ver=2, servers=2, clients=0, CPUs=8, heap=2.0GB]

The only thing that worked for me is to use Ignition.start([default-config.xml]) and then Ignition.ignite("grid") works; but now I have a second instance running on my machine:

Topology snapshot [ver=3, servers=3, clients=0, CPUs=8, heap=2.2GB]

Is Ignition.ignite bugged or is there something more I need to do to get it to work?

I am using apache-ignite-fabric-1.4.0


Solution

  • Your client application also needs to start a node. It will join the topology and provide the connectivity with the cluster. Most likely you don't want this node to store any data or execute jobs. If this is the case, start it in client mode:

    Ignition.setClientMode(true);
    
    Ignite ignite = Ignition.start(..);
    

    After this you should see this topology snapshot (note that there are still 2 servers, but 1 client is added:

    Topology snapshot [ver=3, servers=2, clients=1, CPUs=8, heap=2.2GB]
    

    Ignition.ignite() method can be used to get a reference to the instance that was already started. If it's not started yet, IllegalStateException is thrown.