feat: retention example
This commit is contained in:
@@ -71,3 +71,17 @@ DELETE topic:
|
||||
```
|
||||
docker exec -it kafka-keys /opt/kafka/bin/kafka-topics.sh --delete --topic keys-topic --bootstrap-server localhost:9092
|
||||
```
|
||||
|
||||
# 05-retention
|
||||
|
||||
5000 ms = 5 seconds of retention
|
||||
|
||||
```
|
||||
sudo chown -R 1000:1000 kafka-data
|
||||
|
||||
sudo docker exec kafka-ret /opt/kafka/bin/kafka-topics.sh --create --topic ret-topic --partitions 1 --bootstrap-server localhost:9092 --config retention.ms=5000 --config segment.ms=2000
|
||||
```
|
||||
|
||||
Kafka moves on from one log file to another based on size or time. These are called "segments". Each segment is a file on disk. Nothing is EVER deleted from the active segment. Only when a segment is "closed" ( rolled over to a new segment ) can it be deleted based on retention policy.
|
||||
|
||||
Just retention above won't work, I need to roll it over too.
|
||||
|
||||
Reference in New Issue
Block a user