Streaming Ingestion Example with Kafka 2/Kafka 3

The following example is based on Kafka 3 runtime arguments and may differ for Kafka 2.

Start Kafka, Zookeeper, and Pinot

Since you already have Kafka, Pinot, and Zookeeper installed, ensure they are running.

It is recommended to create new topics for each service to do testing.

Before running any Pinot commands set, set Java 11 on the CLI and export other required configurations.

Bash
Copy

Create different tables and schemas.

  1. Navigate to the Kafka 2 home directory using the following command.
Bash
Copy

If your cluster is Kerberized, complete the following steps. If not, you can skip the below steps and proceed to the next step.

Bash
Copy
  1. Copy and run the below command from kafka-env.sh
Bash
Copy

It is recommended to update the hostname and topic name.

Create Kafka Topic

  1. Create a Kafka topic named events for ingestion.

For Kafka 3, use the port 6669.

Bash
Copy
  1. Verify that the topic was created.
Bash
Copy

Generate Sample Data

  1. Generate sample data using the below python script.

Create a script (datagen.py) to generate JSON records.

Bash
Copy
  1. Run the script and pipe its output to Kafka.

Before running the below data generation command, create the following file.

Bash
Copy
Bash
Copy

This command continuously generate the data until you Interrupt the command using ctrl + C.

Verify Kafka Messages

Consume and verify the messages.

Bash
Copy

Define Pinot Schema

Create a file /tmp/pinot/schema-stream.json.

Bash
Copy

Define Pinot Table Configuration

Create a file /tmp/pinot/table-config-stream.json.

Update the following in table-config-stream.json

  1. Table and Schema names
  2. stream.kafka.broker.list based on your broker list.
Bash
Copy

Create Pinot Schema and Table

Run the following command:

Bash
Copy

Query Ingested Data

Open Pinot UI at http://localhost:9000/#/query and run:

Bash
Copy

This must return the events that were ingested into Kafka and processed by Pinot.

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated