For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Example: Persisting to a Database

Step-by-step example of one-way data replication from GridGain to a MySQL relational database using the GridGain Source Connector and the Confluent JDBC Sink Connector.

The example demonstrates one-way GridGain-to-RDBMS data replication. GridGain Source Connector streams data from GridGain into Kafka with the data schema attached. JDBC Sink Connector streams the data from Kafka into relational tables using attached data schema.

Prerequisites

Step 1: Install GridGain Source Connector

1.1. Prepare GridGain Connector Package

Download the gridgain/gridgain-kafka-connect component that matches your GridGain version from Confluent Hub, unzip it, and rename the extracted directory to gridgain-kafka-connect. If you run GridGain Ultimate Edition, copy $IGNITE_HOME/libs/gridgain-ultimate/*.jar into the gridgain-kafka-connect/lib directory.

1.2. Register GridGain Connector with Kafka

In this example we assume /opt/kafka/connect is the Kafka connectors installation directory.

For every Kafka Connect worker:

  1. Copy the gridgain-kafka-connect directory you prepared in the previous step to /opt/kafka/connect on the Kafka Connect worker.

  2. Edit Kafka Connect Worker configuration ($KAFKA_HOME/config/connect-standalone.properties for single-worker Kafka Connect cluster or $KAFKA_HOME/config/connect-distributed.properties for multiple node Kafka Connect cluster) to register the connector on the plugin path:

Step 2: Install JDBC Sink Connector

  1. Unzip the package and rename the extracted directory to confluentinc-kafka-connect-jdbc.

  2. In this example we use MySQL Server 8 as the RDBMS. Download the MySQL Server JDBC Driver and copy the driver JAR into the confluentinc-kafka-connect-jdbc/lib directory.

    For every Kafka Connect worker:

    1. Copy the JDBC Connector package directory /opt/kafka/connect to the Kafka Connect worker.

    2. Edit Kafka Connect Worker configuration ($KAFKA_HOME/config/connect-standalone.properties for single-worker Kafka Connect cluster or $KAFKA_HOME/config/connect-distributed.properties for multiple node Kafka Connect cluster) to register the connector on the plugin path:

Step 3: Configure and Start GridGain Cluster

In this example we will start only one GridGain server node.

  1. Create the ignite-server.xml configuration file:

  2. Start GridGain node (the below command assumes you are in the directory where ignite-server.xml is located):

Step 4: Create GridGain Tables and Add Some Data

In GridGain Nebula, go to the Queries page, create a table called Person, and add some data to the table:

Step 5: Initialize MySQL Database

In DBeaver connect to MySQL as administrator and:

  1. Create database gridgain-kafka-mysql

  2. Create user demo with password demo

  3. Grant the demo user full privileges to the gridgain-kafka-mysql database.

Creating the Database

Step 6: Start Kafka Cluster

In this example we will start only one Kafka broker.

  1. Start Zookeeper:

  2. Start Kafka Broker:

Step 7: Configure and Start Kafka Connect Cluster

In this example we will start only one Kafka Connect worker.

7.1. Configure Kafka Connect Worker

In this example we need data schema attached to data so make sure you have the following properties in your Kafka Connect worker configuration ($KAFKA_HOME/config/connect-standalone.properties for single-worker Kafka Connect cluster or $KAFKA_HOME/config/connect-distributed.properties for multiple node Kafka Connect cluster):

7.2. Configure GridGain Source Connector

Create the kafka-connect-gridgain-source.properties configuration file (replace IGNITE_CONFIG_PATH with a path to your ignite-server.xml):

7.3. Configure JDBC Sink Connector

Create the kafka-connect-mysql-sink.properties configuration file:

7.4. Start Kafka Connect Worker

The following command assumes you are in the directory where the source and sink connector configurations are located:

Check the source and sink connectors status. If everything is OK, you will see each connector running two tasks. For example, if you have curl and jq available on a Kafka Connect worker, you can run:

Step 8: Observe Initial Data Load

In DBeaver, connect to the gridgain-kafka-mysql database and see the Sink Connector created table quickstart-SQL_PUBLIC_PERSON that already contains 2 entries:

Step 9: Observe Runtime Data Load

Add more person data to the source cluster. In GridGain Nebula, execute this query:

In DBeaver, get the latest quickstart-SQL_PUBLIC_PERSON table data and see the new entry appeared:

Step 10: Observe Dynamic Reconfiguration

Create a new table called City in the source cluster and load some data into it. In GridGain Nebula, execute the query:

In DBeaver, see the Sink Connector created the new quickstart-SQL_PUBLIC_CITY table containing the 2 entries:

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

Last updated

Was this helpful?