일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- istio #k8s #kubernetes
- 오블완
- Grid #CSS
- publishnotreadyaddress
- Kafka #카프카
- 백준 #10430
- shell #shell script
- Linux #wc
- EFK
- 네트워크 #NW
- 티스토리챌린지
- dump #jattach
- Node #POD #Container
- OCP
- lvm #lv #vg #pv
- PODS #POD #pods #pod #파드 #재기동 #롤링재기동 #rolling
- Excel #엑셀
- Swap Memory
- Python #pakage
- EKS
- jmap #jstack
- lenova #레노버 #노트북
- NameSpace #NS
- DB #mariaDB #SQL
- bootstrap #css #CSS
- jgrp000032 #ocp #
- CI #CD #CI/CD
- test #비교
- dify
- function #사용자 정의 함수
- Today
- Total
BEOM_IT
Kafka - 간단한 이론 및 명령어 본문
kafka=> Producer -> kafka Server -> Consumer
- 비동기 처리를 위한 메시징 큐(FIFO)
kafka-topics.sh
- 토픽에 관련된 작업을 할 수 있는 스크립트
sh bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --topic test-topic
- test topic명의 topic 생성
sh bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --partitions 10--replication-factor 1--topic test-topic2 --config retention.ms=172800000
- 원하는 설정을 입력한 topic 생성
sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic test-topic --describe
- topic의 설정 정보 확인
sh bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic test-topic --alter --partitions 3
- topic의 설정 변경( 파티션은 줄일수는 없다.)
kafka-configs.sh
- 일부 옵션들을 설정하는 스크립트
sh bin/kafka-configs.sh --bootstrap-server localhost:9092 --broker 0--all --describe
- 카프카 브로커 설정 확인
kafka-console-producer.sh
- 카프카 브로커에 메시지를 전송 하는 스크립트
sh bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic test-topic
- 메시지 키 설정 X
sh bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic test-topic --property "parse.key=true"--property "key.separator=:"
- 메시지 키 설정 O
kafka-console-consumer.sh
- 카프카에 적재된 데이터를 가져오는 스크립트
sh bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 \
--topic test-topic \
--property print.key=true \ ->console창 출력여부
--property key.seperator=: \ ->key,value 파싱 구분
--from-beginning\
--max-messages 3\
--partition 0
- --from-beginning 옵션은 토픽에 저장된 가장 처음 데이터 부터 출력
- print.key=true 옵션은 토픽에 저장된 데이터 키,값 가져오기
- --max-messages 옵션은 데이터 개수를 지정
- --partition 옵션은 특정 파티션에서 데이터 가져오기
kafka-consumer-group.sh
- 컨슈머 그룹을 다루기 위한 스크립트
sh bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
- 전체 리스트 보기
sh bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group test-group --describe
- 상세 보기
- CURRENT-OFFSET : 현재까지 가져간 레코드의 오프셋 위치
- LOG-END-OFFSET : 마지막 레코드의 오프셋 위치
- LAG : LOG-END-OFFSET - CURRENT-OFFSET = 지연된 레코드 수
오프셋 리셋하기
- --reset offsets 옵션을 이용해 리셋 가능