Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Embedded Mode

How to start and manage a GridGain 9 cluster from a Java project using embedded mode.

In most scenarios, you would use GridGain CLI tool to start and manage your GridGain cluster. However, in some scenarios it is preferable to manage the cluster from a Java project. Starting and working with the cluster from code is called "embedded mode".

This tutorial covers how you can start GridGain 9 from your Java project.

Unlike in GridGain 8, nodes in GridGain 9 are not separated into client and server nodes. Nodes started from embedded mode will be used to store data by default.

Prerequisites

GridGain is tested on Oracle JDK 11, 17, 21, and 25 (LTS), as well as JDK 26 (STS). Other Java vendors are supported, but may have minor discrepancies in performance or stability.

Short-term support (STS) Java versions are supported only until the next STS release, Long-term support (LTS) versions are not affected by this policy.

Add GridGain to Your Project

First, you need to add GridGain to your project. The easiest way to do this is by using Maven:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>GridGain External Repository</id>
        <url>https://maven.gridgain.com/nexus/content/repositories/external</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>org.gridgain</groupId>
        <artifactId>ignite-api</artifactId>
        <version>9.1.28</version>
    </dependency>

    <dependency>
        <groupId>org.gridgain</groupId>
        <artifactId>ignite-runner</artifactId>
        <version>9.1.28</version>
    </dependency>
</dependencies>

Prepare GridGain Configuration

To start a GridGain node, you will need to provide a configuration file. For this tutorial, you can use a simple configuration file, but in real environments we recommend creating one that suits your needs. For more information on node configuration, see node configuration parameters documentation.

Pass Additional JVM Parameters

The following JVM parameters must be passed to your application to make proprietary SDK APIs available. These parameters are required for all supported Java versions:

Start GridGain Server Nodes

To start a GridGain node, use the following code snippet:

This code snippet starts a GridGain node with the name node that uses the configuration from the file specified in the configPath parameter and stores data in the folder specified in the workDir parameter. When the node is started, this method returns an instance of IgniteServer class that can be used to work with the node.

Passing Configuration as String

Alternatively, you can pass the configuration as a string in the start() method. This way, you do not need a separate configuration file, however node configuration will be locked to the one provided at node start.

Initiate a Cluster

Started nodes find each other by default, but they do not form an intractable cluster unless the cluster is initiated. You need to initiate the cluster to activate the node. If there are multiple nodes, once the cluster is activated, they will form a topology and automatically distribute workload between each other.

Use the code snippet below to initiate a cluster:

Provide your license by using the license() method, which accepts the contents of the license file, not a path to it. Use the clusterConfiguration() method for cluster configuration.

Get an Ignite Instance

Now that the cluster is started, you can get an instance of the Ignite class:

This instance can be used to start working with the cluster. The future will be returned once the cluster is active.

In the following example, you interact with the cluster using the SQL API:

Session is closable, but it is safe to skip close() method for DDL and DML queries, as they do not keep cursor open.

More examples of working with GridGain can be found in the examples repository.

Next Steps

From here, you may want to:

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?