GridGain Developers Hub
GitHub logo GridGain iso GridGain.com
GridGain Software Documentation

Starting and Shutting Down Nodes

This chapter explains how to start server nodes and client nodes. Refer to the Installation Guide for the installation instructions.

You can start a node by running the ignite.sh script.

Starting Server Nodes

To start a regular server node, use the following command or code snippet:

ignite.sh path/to/configuration.xml
IgniteConfiguration cfg = new IgniteConfiguration();
Ignite ignite = Ignition.start(cfg);

Ignite is an autoclosable resource. You can use the try-with-resource statement to automatically close it:

IgniteConfiguration cfg = new IgniteConfiguration();

try (Ignite ignite = Ignition.start(cfg)) {
    //
}

Starting Client Nodes

To start a client node, simply enable the client mode in the node’s configuration:

<bean class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="clientMode" value="true"/>
    <!-- other properties -->
</bean>
IgniteConfiguration cfg = new IgniteConfiguration();

// Enable client mode.
cfg.setClientMode(true);

// Start a client
Ignite ignite = Ignition.start(cfg);

Shutting Down Nodes

If you started a node by running the ignite.sh script and didn’t detach from the terminal, you can stop the node by hitting Ctrl+C. If you detached from the terminal, you can kill the node by executing the kill command:

kill <pid>

To stop a node from the program that launched it, use the following code:

ignite.close();

When the close() method is called, all cache instances that were obtained from the ignite instance will be closed as well.

Ignition::Stop(ignite.GetName(), false);

Setting JVM Options

There are several ways you can set JVM options when starting a node by running the ignite.sh script. These ways are described in the following sections.

JVM_OPTS System Variable

You can set the JVM_OPTS environment variable:

export JVM_OPTS="$JVM_OPTS -Xmx6G"; $IGNITE_HOME/bin/ignite.sh

Command Line Arguments

You can also pass JVM options by using the -J prefix:

./ignite.sh -J-Xmx6G