Sign InTry Free

Quick Start Guide on Integrating TiDB with Confluent Platform

This document introduces how to integrate TiDB to Confluent Platform using TiCDC.

Confluent Platform is a data streaming platform with Apache Kafka at its core. With many official and third-party sink connectors, Confluent Platform enables you to easily connect stream sources to relational or non-relational databases.

To integrate TiDB with Confluent Platform, you can use the TiCDC component with the Avro protocol. TiCDC can stream data changes to Kafka in the format that Confluent Platform recognizes. For the detailed integration guide, see the following sections:


  • Make sure that Zookeeper, Kafka, and Schema Registry are properly installed. It is recommended that you follow the Confluent Platform Quick Start Guide to deploy a local test environment.

  • Make sure that JDBC sink connector is installed by running the following command. The result should contain jdbc-sink.

    confluent local services connect connector list

Integration procedures

  1. Save the following configuration into jdbc-sink-connector.json:

    { "name": "jdbc-sink-connector", "config": { "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", "tasks.max": "1", "topics": "testdb_test", "connection.url": "jdbc:sqlite:/tmp/test.db", "connection.ds.pool.size": 5, "": "test", "auto.create": true, "auto.evolve": true } }
  2. Create an instance of the JDBC sink connector by running the following command (assuming Kafka is listening on

    curl -X POST -H "Content-Type: application/json" -d @jdbc-sink-connector.json
  3. Deploy TiCDC in one of the following ways. If TiCDC is already deployed, you can skip this step.

    Make sure that your TiDB and TiCDC clusters are healthy before proceeding.

  4. Create a changefeed by running the cdc cli command:

    ./cdc cli changefeed create --pd="" --sink-uri="kafka://" --opts "registry="

Test data replication

After TiDB is integrated with Confluent Platform, you can follow the example procedures below to test the data replication.

  1. Create the testdb database in your TiDB cluster:


    Create the test table in testdb:

    USE testdb; CREATE TABLE test ( id INT PRIMARY KEY, v TEXT );
  2. Insert data into TiDB:

    INSERT INTO test (id, v) values (1, 'a'); INSERT INTO test (id, v) values (2, 'b'); INSERT INTO test (id, v) values (3, 'c'); INSERT INTO test (id, v) values (4, 'd');
  3. Wait a moment for data to be replicated to the downstream. Then check the downstream for data:

    sqlite3 test.db sqlite> SELECT * from test;

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
TiDB Dedicated
TiDB Serverless
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.