Kafka 存储配置参考
| Topic 配置参数 | 所属机制 | 主要作用 | 典型默认值 |
|---|---|---|---|
segment.bytes | Segment | 日志分段大小 | 1 GiB |
segment.ms | Segment | 分段滚动时间 | 7 天 |
segment.index.bytes | Index | 索引文件大小限制 | 10 MiB |
index.interval.bytes | Index | 稀疏索引字节间隔 | 4096 |
max.message.bytes | Record Batch | 允许的最大消息批次大小 | 约 1 MiB |
compression.type | Compression | 日志压缩算法策略 | producer |
flush.messages | Flush | 消息数量刷盘阈值 | Long.MAX_VALUE |
flush.ms | Flush | 时间刷盘阈值 | Long.MAX_VALUE |
cleanup.policy | Cleanup | 日志清理策略 | delete |
retention.ms | Retention | 日志保留时间 | 7 天 |
retention.bytes | Retention | 单分区日志保留大小 | -1 |
delete.retention.ms | Compaction | Tombstone 保留时间 | 24 小时 |
min.cleanable.dirty.ratio | Compaction | 日志压缩清理比例阈值 | 0.5 |
min.compaction.lag.ms | Compaction | 消息最短压缩等待时间 | 0 |
file.delete.delay.ms | Cleanup | 文件延迟删除时间 | 60000 |
这些是常见默认值,实际 Topic 配置可能继承或覆盖 Broker 的默认配置。
相关入口
参考资料
- 消息生产流程:客户端路由、批次、网络发送和结果处理。
- 消息消费流程:Fetch、消费位置与提交。
- 副本同步流程:ISR、HW、LEO 与故障恢复。
- 可靠性与一致性:确认、事务与交付语义。
- 高性能设计:批处理、Page Cache、零拷贝与性能权衡。
- Apache Kafka:Message Format、Design、Topic-Level Configs。
- Kafka 4.0.0 源码:OffsetIndex、TimeIndex。