Configure Kafka Tiered-Storage with S3

This page explains how to enable Kafka Tiered Storage, configure Ambari, and verify your setup. All environment-specific values are shown as placeholders — replace them with values from your environment before running any commands.

Tiered storage with Kraft has not been certified.

Prerequisites

Tiered storage requires JDK 17 with Kafka 3. Kafka 3.7.2 supports JDK 17, so no Kafka rebuild is required.

Bash
Copy

Ambari Configuration Steps

kafka3-log4j

To see detailed segment offloading logs, configure the above loggers to DEBUG. Configure only if detailed logs are required.

Bash
Copy

kafka3-broker.xml

Bash
Copy
  • After restarting the Kafka Broker, you must see this message in the Kafka Broker logs:
Bash
Copy

Credentials Configuration with jceks

  • Run the below commands to store access/secret keys in the kafka3 jceks file.
  • Run on all broker nodes.
  • remote.log.storage.system.enable=true must be set to enable Kafka3-env to export access/secret keys.
Bash
Copy

Create a Tiered Topic

  1. Create the topic.
Bash
Copy
ConfigDescription
local.retention.bytesMaximum bytes retained locally on the broker before offloading to remote storage (128 MB)
local.retention.msHow long segments are kept locally before being eligible for offload (1000 ms)
segment.bytesSize at which a log segment is rolled and becomes a candidate for offload (128 MB)
remote.storage.enableEnables tiered storage for this topic

All configuration values above are intentionally set to minimal sizes for testing purposes, to trigger segment rolling and offloading as quickly as possible.

  1. Produce test data
Bash
Copy
ConfigDescription
num-recordsTotal number of records to produce
record-sizeSize of each record in bytes (1 KB)
throughputProduce as fast as possible
acksLeader acknowledgment only then send
linger.msWaits up to 50ms to batch records before sending
batch.sizeMaximum batch size per send (128 KB)
buffer.memoryTotal producer buffer memory (64 MB)
  1. Verify offload to object storage
Bash
Copy

It might take some time for Kafka to offload the cold data.

  1. Verify that the data gets deleted locally.
Bash
Copy
  1. Consume the data from object storage
Bash
Copy

Troubleshooting

Error Running Brokers After Disabling Tiered Storage While Tiered Storage Exists

Bash
Copy
  • Root cause: All Kafka topics with the remote.storage.enable=true property should be deleted before disabling Tiered Storage. This is a known limitation.
  • Forced Solution: Run Brokers with Tiered Storage enabled, then delete the topics
Bash
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
  Last updated