kafka-configs CLI tool lets you override configurations for specific topics without affecting the cluster defaults.
What you’ll learn:
- How to view current topic configurations
- How to add configuration overrides with kafka-configs
- How to remove configuration overrides
- Common configurations that need per-topic tuning
Common topic configuration overrides
| Configuration | Default | Description |
|---|---|---|
min.insync.replicas | 1 | Minimum ISRs for acks=all |
retention.ms | 7 days | Data retention time |
retention.bytes | -1 (unlimited) | Maximum partition size |
cleanup.policy | delete | delete or compact |
max.message.bytes | 1 MB | Maximum message size |
compression.type | producer | Broker-side compression |
Override topic configuration defaults
Thekafka-configs CLI tool allows you to set, view, and delete configurations for topics, brokers, and other entities without restarting the cluster. Use CLI commands with appropriate extensions for your platform (e.g., kafka-configs.bat for Windows, kafka-configs.sh for Linux).
Let’s change the min.insync.replicas configuration of a topic. The default broker value is 1, but for production with replication factor of 3, a value of 2 is recommended. See min.insync.replicas for details.
Before running Kafka CLIs make sure that you have started Kafka successfully.
First, create a topic named configured-topic with 3 partitions and a replication factor of 1, using Kafka topics CLI, kafka-topics
min.insync.replicas value for the topic configured-topic to 2
min.insync.replicas=2.
You can delete the configuration override by passing --delete-config in place of the --add-config flag.
Other common configuration changes
Set retention to 30 days
Enable log compaction
Set multiple configurations at once
See it in practice with ConduktorConduktor Console provides a visual interface for viewing and modifying topic configurations. See all overrides at a glance and make changes without memorizing CLI syntax.
Next steps
- Configure min.insync.replicas for durability
- Set up log retention for data lifecycle
- Enable log compaction for changelog topics