Configuration
Broker Configs
설정파일 : $KAFKA_HOME/config/server.properties
반드시 설정해야 하는 3가지
broker.id
log.dirs
zookeeper.connect
Topic-level configurations
Log Basics
log.dirs : 로그데이터 저장 디렉토리, 설정하지 않을 경우 log.dir 에 설정된 곳 사용
num.partitions : number of log partitions per topic
num.recovery.threads.per.data.dir
Log Retention
- log.retention.hour : 로그 수명, 설정된 수명이 지나면 삭제
Zookeeper 관련
zookeeper.connect : zookeeper connection string
ex> single : zookeeper.connect=localhost:2181
ex> cluster : zookeeper.connect=127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002
zookeeper.connection.timeout.ms : zookeeper 커넥션 타임아웃 시간 설정
Producer Configs
bootstrap.servers
초기 클러스터 연결 시 사용, 최초 전체 서버를 찾는데 사용함
ex> bootstrap.servers=kafka1:9092,kafka2:9092,kafka3:9002
compression.type : 메시지 압축포맷 ( none, gzip, snappy, lz4 )
acks
acks=0
서버에서 수신확인 (acknowledgment)을 기다리지 않음 (will not wait)
서버가 record를 수신했다는 보장을 할 수 없고 (no guarantee), retries configuration 설정도 적용되지 않음
acks=1
- leaer가 레코드를 자신의 로컬 로그에 쓰고 follower로 부터 수신확인(acknowledgment)을 기다리지 않고 응답
- follower가 record를 복제하기전 이면 record는 없어질 수 있음
acks=all
- leader는 레코드가 동기로 복제되고 알림이 오기를 기다림, 최소한 하나의 복제가 살아있는 한 레코드가 소실되지 않는 것을 보장함. ( This means the leader will wait for the full set of in-sync replicas to acknowledge the record )
linger.ms
특정시간 동안 버퍼링해서 묶어서 하나의 배치 요청으로 보내는 것, 지정된 값 만큼 record전송을 지연하지만 bach.size에 도달하면 전송함
time based batching
batch.size
동일파티션에 여러개의 레코드가 보내질때 지정된 크기보다 작으면, 지정된 사이즈만큼 모아서 전송
size based batching
retries
- producer가 레코드를 보낼 때 에러가 발생 시 재시도 횟수 설정값, 재시도시 잠재적으로 순서가 바뀔 수 있음 ( will potentially change the ordering of records)
max.in.flight.requests.per.connection
- client가 blocking 되기 전에 단일 커넥션에 보낼 답을 받지 못한 최대 요청 수
- 1보다 큰 값이고 실패한 보내기가 있다면, 재시도 때문에 메시지 정렬 이슈가 있음
Consumer Configs
설정파일 위치 : $KAFKA_HOME/config/consumer.properties
bootstrap.servers
group.id : consumer gropu id
zookeeper.connect : zookeeper connection string
New Consumer Configs
Old Consumer Configs
Kafka Connect Configs
Kafka Streams Configs
참고사이트