Skip to content

Topic Configuration

Topic-level configuration is dynamic config: read and written over the standard Kafka protocol, persisted in the meta layer, no restart needed. Unlike Broker Runtime Configuration (static, process-level), it applies to an individual topic.

How to read/write

OperationKafka APICLI example
ReadDescribeConfigskafka-configs.sh --describe --entity-type topics --entity-name <topic>
Full alterAlterConfigskafka-configs.sh --alter --entity-type topics --entity-name <topic> --add-config k=v
Incremental alterIncrementalAlterConfigssame as above (recent kafka-configs.sh uses incremental by default)
Set on createCreateTopics --configkafka-topics.sh --create --topic <topic> --config k=v

Keys passed via --config at create time are persisted too and can later be echoed back by --describe.

Supported standard keys

The following standard Kafka topic config keys can be stored and echoed back correctly:

KeyDescription
retention.msMessage retention time
cleanup.policyCleanup policy (delete / compact)
compression.typeCompression type
max.message.bytesMax size of a single batch
retention.bytesMax retained bytes per partition
segment.bytesSegment size
Other standard keysStored and echoed

Status and limitations

Current implementation status

Topic config today behaves as "storable, echoable, with correct dynamic-source marking", but most keys are not yet fully wired into engine behavior:

  • A written config is persisted, and DescribeConfigs echoes it back with the correct dynamic source marking (dynamic topic config).
  • However, the value does not necessarily change actual engine behavior yet. For example, retention.ms is only partially applied; cleanup.policy=compact, compression.type, etc. are mostly not enforced in the storage engine yet.
  • Think of topic config as "metadata first": the API and echo are ready; behavior enforcement is being filled in incrementally.

Config enforcement is on the Roadmap.

Relationship to broker config

max.message.bytes has both a broker-level default (kafka_runtime.max_message_bytes, see Broker Configuration) and a topic-level override. Cluster-level switches (e.g. auto.create.topics.enable) are a separate category, see Dynamic Configuration.

🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀