Kafka 프로듀서

Apache Kafka 입문

Mike Metzger

Data Engineering Consultant

프로듀서란?

  • Kafka 토픽에 메시지를 기록합니다
    • 퍼블리셔라고도 합니다
  • 프로듀서가 보낸 메시지는 Kafka에 저장되어 나중에 사용됩니다
  • 프로듀서는 여러 개일 수 있습니다
  • 하나 이상의 토픽에 쓸 수 있습니다
Apache Kafka 입문

프로듀서 유형

  • 프로듀서 유형은 다양합니다
    • 커맨드라인
      • kafka-console-producer.sh
    • Python
    • Java
    • 기타 여러 언어
    • Kafka Connect
Apache Kafka 입문

kafka-console-producer.sh

  • 다른 Kafka 도구와 함께 bin/ 폴더에 있습니다
    • bin/kafka-console-producer.sh
  • 필수/선택 항목을 포함한 여러 CLI 옵션이 있습니다
  • 필수 옵션:
    • --bootstrap-server - 사용할 서버 지정
      • --bootstrap-server localhost:9092
    • --topic
      • --topic phishing-sites
  • 기본적으로 메시지를 입력할 수 있는 연결을 엽니다
    • 종료: Ctrl-C
  • | 기호로 메시지를 파이프로 전달할 수도 있습니다
Apache Kafka 입문

예시

  • 대화형 예시
bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic testing
>This is the first message
>This is the second message
>This is the third message
<ctrl+c to exit>
  • 비대화형
echo "This is the first message" |
bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic testing
Apache Kafka 입문

연습해 봅시다!

Apache Kafka 입문

Preparing Video For Download...