Skip to main content
Apache Kafka is a distributed event streaming platform used for high-performance data pipelines, streaming analytics, and data integration. Apache Kafka Connect is a tool to scalably and reliably stream data between Apache Kafka® and other data systems. Kafka Connect is an ecosystem of pre-written and maintained Kafka Producers (source connectors) and Kafka Consumers (sink connectors) for data products and platforms like databases and message brokers. This guide explains how to set up Kafka and Kafka Connect to stream data from a Kafka topic into your .

Prerequisites

To follow the steps on this page:
  • Create a target with Real-time analytics enabled.

    You need your connection details. This procedure also works for .

Install and configure Apache Kafka

To install and configure Apache Kafka:
  1. Extract the Kafka binaries to a local folder
    From now on, the folder where you extracted the Kafka binaries is called <KAFKA_HOME>.
  2. Configure and run Apache Kafka
    Use the -daemon flag to run this process in the background.
  3. Create Kafka topics In another Terminal window, navigate to <KAFKA_HOME>, then call kafka-topics.sh and create the following topics:
    • accounts: publishes JSON messages that are consumed by the timescale-sink connector and inserted into your .
    • deadletter: stores messages that cause errors and that Kafka Connect workers cannot process.
  4. Test that your topics are working correctly
    1. Run kafka-console-producer to send messages to the accounts topic:
    2. Send some events. For example, type the following:
    3. In another Terminal window, navigate to <KAFKA_HOME>, then run kafka-console-consumer to consume the events you just sent:
      You see
Keep these terminals open, you use them to test the integration later.

Install the sink connector to communicate with Tiger Cloud

To set up Kafka Connect server, plugins, drivers, and connectors:
  1. Install the connector In another terminal window, navigate to <KAFKA_HOME>, then download and configure the sink and driver.
  2. Start Kafka Connect
    Use the -daemon flag to run this process in the background.
  3. Verify Kafka Connect is running In yet another another terminal window, run the following command:
    You see something like:

Create a table in your service to ingest Kafka events

To prepare your for Kafka integration:
  1. Connect to your
  2. Create a hypertable to ingest Kafka events
    When you create a using CREATE TABLE … WITH …, the default partitioning column is automatically the first column with a timestamp data type. Also, creates a columnstore policy that automatically converts your data to the , after an interval equal to the value of the chunk_interval, defined through compress_after in the policy. This columnar format enables fast scanning and aggregation, optimizing performance for analytical workloads while also saving significant storage space. In the conversion, s are compressed by up to 98%, and organized for efficient, large-scale queries. You can customize this policy later using alter_job. However, to change after or created_before, the compression settings, or the the policy is acting on, you must remove the columnstore policy and add a new one. You can also manually convert s in a to the .

Create the Tiger Cloud sink

To create a sink in Apache Kafka:
  1. Create the connection configuration
    1. In the terminal running Kafka Connect, stop the process by pressing Ctrl+C.
    2. Write the following configuration to <KAFKA_HOME>/config/timescale-standalone-sink.properties, then update the <properties> with your connection details.
    3. Restart Kafka Connect with the new configuration:
  2. Test the connection To see your sink, query the /connectors route in a GET request:
    You see:

Test the integration with Tiger Cloud

To test this integration, send some messages onto the accounts topic. You can do this using the kafkacat or kcat utility.
  1. In the terminal running kafka-console-producer.sh enter the following json strings
    Look in your terminal running kafka-console-consumer to see the messages being processed.
  2. Query your for all rows in the accounts table
    You see something like:
You have successfully integrated Apache Kafka with .