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

Persist Your Data

Set up and use GridGain 9's RocksDB-based persistent storage with the Chinook database in a Docker environment, and verify that data survives a restart.

Introduction

About this Guide

This guide will walk you through the basics of setting up and using GridGain 9's RocksDB-based persistent storage with the Chinook database in a Docker-based environment.

Prerequisites

  • Up-to-date versions of Docker and Docker Compose;

  • Terminal or command line access;

  • Basic SQL knowledge;

  • At least 8GB of free RAM for the GridGain cluster.

Understanding Persistence in GridGain

Persistence Architecture

GridGain persistence is designed to provide quick and responsive persistent storage. When using persistent storage:

  • GridGain stores all data in it on disk;

  • It loads as much data as possible into RAM for processing;

  • Data is split into multiple partitions, with each partition stored in a separate file on disk;

  • In addition to data partitions, GridGain stores indexes and metadata on disk.

This architecture combines the performance benefits of in-memory computing with the durability of disk-based storage.

Storage Engine Types

Persistent Storage Options

  • AIPersist Engine - Default persistent storage engine with checkpointing;

  • RocksDB Engine - LSM-tree based persistent storage optimized for write-heavy workloads.

Volatile Storage Options

  • AIMem Engine - In-memory storage with no persistence.

Storage Profiles

In GridGain 9, persistence is configured by using storage profiles. A storage profile defines how data is stored, cached, and managed by the storage engine.

Each storage profile has specific properties depending on the engine type, but all profiles must specify the following properties:

  • name - A unique identifier for the profile

  • engine - The storage engine to use

Distribution Zones

Distribution zones control how data is distributed across the cluster and which storage profiles to use. They allow you to:

  • Control the number of data replicas;

  • Specify which nodes can store data;

  • Define how data is partitioned;

  • Assign storage profiles to determine persistence type.

Setting Up a Persistent Cluster

Docker Environment Configuration

We will use Docker Compose to create a multi-node GridGain cluster with persistent storage.

Creating the Docker Compose File

Download docker-compose.yml file or create it in your working directory:

The node_config configuration in the Docker Compose file:

  • Adds a storage profile named rocksDbProfile that uses the RocksDB engine;

  • Sets the storage size to 256MB (268435456 bytes) by default;

  • Stores persistent data in the data directory where docker was run.

Starting the Cluster

Download the Docker image:

Run the following command to start your cluster:

Verifying Cluster Deployment

Check that all nodes are running:

You should see output similar to:

Verify the Docker network:

Configuring Persistent Storage

Connecting to the Cluster

Connect to the GridGain CLI:

When the CLI tool offers to connect to default node, confirm the connection. If you ever get disconnected, you can connect again by typing the following command:

Initializing the Cluster

Before using the cluster, initialize it:

You should see the message "Cluster was initialized successfully".

Examining Storage Profiles

Verify the configured storage profiles:

You should see output showing the rocksDbProfile configuration along with the default profiles.

Creating Distribution Zones for Persistence

Enter the interactive SQL CLI:

Create a distribution zone that uses our RocksDB storage profile:

Building the Chinook Database with Persistence

About the Chinook Database

The Chinook database represents a digital media store with tables for artists, albums, tracks, and more. It's commonly used as a sample database for demonstrating database features.

Creating Persistent Database Tables

Create the necessary tables for the Chinook database using our RocksDB persistent zone:

Loading Sample Data

Insert sample data into the tables:

Querying the Database

Test that your data was inserted correctly:

Testing Persistence Capabilities

Verifying Data Before Restart

Perform additional queries to ensure your data is properly stored:

Restarting the Cluster

To restart the cluster, you need to first exit the CLI tool.

  • Exit the SQL CLI with the exit; command,

  • Then exit the main CLI with the exit command.

Restart the Docker containers:

Verifying Data Persistence After Restart

Reconnect to the CLI:

The cluster is already initialized, so you can go directly to the SQL CLI:

Run the same query to verify the data persisted through the restart:

Wrap Up

Summary

GridGain 9 with RocksDB persistent storage provides a powerful way to maintain data durability while leveraging in-memory computing performance. RocksDB is particularly well-suited for write-intensive workloads, making it an excellent choice for many production environments.

Additional Resources

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

spinner

Last updated

Was this helpful?