07.KafkaLogFile
Last updated
Last updated
Physical View
Partition์ Broker๋ค์ ๋ถ์ฐ๋๋ฉฐ, ๊ฐ Partition์ Segment File๋ค๋ก ๊ตฌ์ฑ๋จ
Rolling Strategy : log.segment.bytes(default 1 GB), log.roll.hours(default 168 hours)
๊ฐ Broker์ log.dirs ํ๋ผ๋ฏธํฐ๋ก ์ ์
Kafka Log Segment File์ Data File์ด๋ผ๊ณ ๋ถ๋ฅด๊ธฐ๋ ํจ
Segment File์ด ์์ฑ๋๋ ์์น๋ ๊ฐ Broker์ server.properties ํ์ผ ์์์ log.dirs ํ๋ผ๋ฏธํฐ๋ก ์ ์ํจ(comma๋ก ๊ตฌ๋ถํ์ฌ ์ฌ๋ฌ ๋๋ ํ ๋ฆฌ ์ง์ ๊ฐ๋ฅ)
๊ฐ Topic๊ณผ ๊ทธ Partition 0์ log.dirs ์๋์ ํ์ ๋๋ ํ ๋ฆฌ๋ก ๊ตฌ์ฑ๋จ
์๋ก, test_topic์ Partition 0์ /data/kafka/kafka-log-a/test_topic-0 ๋๋ ํ ๋ฆฌ๋ก ์์ฑ๋จ
test_topic ์ Partition 0 ๋๋ ํ ๋ฆฌ์ ์์ฑ๋๋ ํ์ผ์ ์
leader-epoch-checkpoint
00000000000000123453.* ํ์ผ์ 00000000000000123453 offset๋ถํฐ 00000000000007735203 offset๊น์ง์ ๋ฉ์์ง๋ฅผ ์ ์ฅ/๊ด๋ฆฌ (00000000000007735203 = 00000000000007735204 -1)
ํ์ฅ์ ํน์ ํ์ผ๋ช ์ผ๋ก ๊ตฌ๋ถํจ
Log Segment File: ๋ฉ์์ง์ metadata๋ฅผ ์ ์ฅ โ .log
Index File: ๊ฐ ๋ฉ์์ง์ Offset์ Log Segment ํ์ผ์ Byte ์์น์ ๋งคํ โ .index
Time-based Index File: ๊ฐ ๋ฉ์์ง์ timestamp๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ฉ์์ง๋ฅผ ๊ฒ์ํ๋ ๋ฐ ์ฌ์ฉ โ .timeindex
Leader Epoch Checkpoint File: Leader Epoch๊ณผ ๊ด๋ จ Offset ์ ๋ณด๋ฅผ ์ ์ฅ โ leader-epoch-checkpoint
Idempotent Producer๋ฅผ ์ฌ์ฉํ๋ฉด โ .snapshot
Transactional Producer๋ฅผ ์ฌ์ฉํ๋ฉด โ .txnindex
์ฒซ๋ฒ์งธ๋ก ์ ์ฅ๋๋ ๋ฉ์์ง์ Offset์ด ํ์ผ๋ช ์ด ๋จ
Partition์ ํ๋ ์ด์์ Segment File๋ก ๊ตฌ์ฑ
Log Segment File์ ํ์ผ๋ช ์ ํด๋น Segment File์ ์ ์ฅ๋ ์ฒซ๋ฒ์งธ ๋ฉ์์ง์ Offset
์๋์ ํ๋ผ๋ฏธํฐ ์ค ํ๋๋ผ๋ ํด๋น๋๋ฉด ์๋ก์ด Segment File๋ก Rolling
log.segment.bytes (default: 1 GB)
log.roll.ms (default: 168 ์๊ฐ)
log.index.size.max.bytes (default: 10 MB)
__consumer_offset (Offset Topic)์ Segment File Rolling ํ๋ผ๋ฏธํฐ๋ ๋ณ๋
offsets.topic.segment.bytes (default: 100 MB)
๊ฐ Broker์๋ 2 ๊ฐ์ Checkpoint File์ด ์กด์ฌ
log.dirs ๋๋ ํ ๋ฆฌ์ ์์นํจ
replication-offset-checkpoint ๋ง์ง๋ง์ผ๋ก Commit๋ ๋ฉ์์ง์ ID์ธ High Water Mark ์์์ Follower๊ฐ ์ด๋ฅผ ์ฌ์ฉํ์ฌ Commit๋์ง ์์ ๋ฉ์์ง๋ฅผ Truncate
recovery-point-offset-checkpoint ๋ฐ์ดํฐ๊ฐ ๋์คํฌ๋ก Flush๋ ์ง์ ๋ณต๊ตฌ ์ค Broker๋ ์ด ์์ ์ดํ์ ๋ฉ์์ง๊ฐ ์์ค๋์๋์ง ์ฌ๋ถ๋ฅผ ํ์ธ