config/server.properties
의 log.dir
옵션에 정의한 디렉토리에 저장ls /tmp/kafka-logs
__consumer_offsets-0 __consumer_offsets-2 __consumer_offsets-30 __consumer_offsets-41 __consumer_offsets-8 log-start-offset-checkpoint
__consumer_offsets-1 __consumer_offsets-20 __consumer_offsets-31 __consumer_offsets-42 __consumer_offsets-9 meta.properties
__consumer_offsets-10 __consumer_offsets-21 __consumer_offsets-32 __consumer_offsets-43 cleaner-offset-checkpoint recovery-point-offset-checkpoint
__consumer_offsets-11 __consumer_offsets-22 __consumer_offsets-33 __consumer_offsets-44 hello.kafka-0 replication-offset-checkpoint
__consumer_offsets-12 __consumer_offsets-23 __consumer_offsets-34 __consumer_offsets-45 hello.kafka.2-0 test-0
__consumer_offsets-13 __consumer_offsets-24 __consumer_offsets-35 __consumer_offsets-46 hello.kafka.2-1 test3-0
__consumer_offsets-14 __consumer_offsets-25 __consumer_offsets-36 __consumer_offsets-47 hello.kafka.2-2 verify-test-0
__consumer_offsets-15 __consumer_offsets-26 __consumer_offsets-37 __consumer_offsets-48 hello.kafka.2-3 verify-test-2-0
__consumer_offsets-16 __consumer_offsets-27 __consumer_offsets-38 __consumer_offsets-49 hello.kafka.3-0 verify-test-3-0
__consumer_offsets-17 __consumer_offsets-28 __consumer_offsets-39 __consumer_offsets-5 hello.kafka.4-0
__consumer_offsets-18 __consumer_offsets-29 __consumer_offsets-4 __consumer_offsets-6 hello.kafka.4-1
__consumer_offsets-19 __consumer_offsets-3 __consumer_offsets-40 __consumer_offsets-7 hello.kafka.4-2
log
index
timeindex
ls /tmp/kafka-logs/hello.kafka.2-0
-rw-r--r--. 1 ec2-user ec2-user 235 May 7 13:23 00000000000000000000.log
-rw-r--r--. 1 ec2-user ec2-user 10485760 May 7 13:01 00000000000000000000.index
-rw-r--r--. 1 ec2-user ec2-user 10485756 May 7 13:01 00000000000000000000.timeindex
-rw-r--r--. 1 ec2-user ec2-user 8 May 7 13:01 leader-epoch-checkpoint
fault tolerant system
(장애 허용 시스템)으로 동작하도록 하는 원동력Cluster의 다수 Broker 중 한 대가 Controller 역할을 한다.
Kafka는 다른 메시징 플랫폼과 다르게 Consumer가 데이터를 가져가더라도 Topic의 데이터는 삭제되지 않는다.
Log Segment
)로 이루어짐log.segment.bytes
log.segment.ms
log.retention.bytes
또는 log.retention.ms
설정값이 넘으면 삭제된다.__consumer_offests
토픽에 저장한다.Consumer Group의 상태를 체크하고 파티션을 Consumer와 매칭되도록 분배하는 역할을 한다.
Rebalance
라고 부른다.Kafka의 메타데이터를 관리한다.
bin/zookeper-shell.sh my-kafka:2181
ls /
[admin, brokers, cluster, config, consumers, controller, controller_epoch, isr_change_notification, latest_producer_id_block, log_dir_event_notification, zookeeper]
get /brokers/ids/0
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://ec2-3-36-77-126.ap-northeast-2.compute.amazonaws.com:9092"],"jmx_port":-1,"host":"ec2-3-36-77-126.ap-northeast-2.compute.amazonaws.com","timestamp":"1683464001941","port":9092,"version":4}
get /controller
{"version":1,"brokerid":0,"timestamp":"1683464002133"}
ls /brokers/topics
[__consumer_offsets, hello.kafka, hello.kafka.2, hello.kafka.3, hello.kafka.4, test, test3, verify-test, verify-test-2, verify-test-3]
ls /brokers
[ids, seqid, topics]
znode
에 Kafka Cluster들을 설정하면 된다.znode
란 Zookeper에서 사용하는 데이터 저장 단위이다.zookeper.connect=localhost:2181/pipeline
zookeper.connect=localhost:2181/recommend
Topic은 Kafka에서 데이터를 구분하기 위해 사용하는 단위이다.
Partition은 Kafka의 병렬처리의 핵심으로써 Consumer Group으로 묶인 Consumer들이 레코드를 병렬로 처리할 수 있도록 매칭된다.
log.retention.ms
log.retention.bytes