Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 2.75 KB

File metadata and controls

57 lines (39 loc) · 2.75 KB

카프카 Local 환경에서 작동하기 (Windows)

설치

실행

  • kafka에서 Broker는 kafka의 서버를 뜻하며 동일 노드 내에서 여러개의 Broker를 띄울 수 있음
  • 이렇게 분산되어서 여러개의 Broker가 띄워져 있으면 이 분산 Message Queue를 관리해주는 역할을 하는것이 Zookeeper
  • kafka 서버를 띄우기 앞서 Zookeeper를 반드시 띄워야 함

Zookeeper 실행

  • .\kafka\bin\windows\zookeeper-server-start.bat kafka\config\zookeeper.properties

  • USAGE : .\zookeeper-server-start.bat zookeeper.properties

    image

Kafka 실행

  • .\kafka\bin\windows\kafka-server-start.bat kafka\config\server.properties

  • USAGE : .\kafka-server-start.bat server.properties

    image

실행확인

  • kafka 기본 port : 9092

  • zookeeper 기본 port : 2181

    image


테스트

토픽(topic) 생성 (broker)

생성한 topic에 message 보내기 (producer)

  • .\kafka\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic heedong

    image

토픽에 있는 메세지 가져오기 (consumer)

  • .\kafka\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic heedong --from-beginning

    image

토픽(topic 삭제)

  • .\kafka\bin\windows\kafka-topics.bat --bootstrap-server localhost:9092 --delete --topic heedong