Step 1: understand Topic & Partition
1. one topic can be distributed to one or multiple brokers
2. each broker hold different partitions for topic
3. one broker hold multiple partitions for one or more topics
4. One partition is impl by one physical folder with multiple files (segment).
Step 2: check the physical file folder on /tmp/kafka-logs (the default folder for kafka logs files)
1. the folder is named as {topic}-{partition no}
2. the same {filename}.index, .log and .timeindex construct one segment.
3. 00000000000000000000 here = the offset of this segment
4. how to locate the message:
1. decide the partition.
2. decide the segment by offset number of message.
3. decide the offset inside of segment.
5. for kafka log, it is clear that the SLM mechanism is used which provides the max write/read turnover.
Step 3: Customize the partition no based on message
Comments
Post a Comment