개인프로젝트/기능프로그램_오늘뭐입지

20240517_Kafka 사용하기

일일일코_장민기 2024. 5. 17. 09:35
728x90

Zookeeper 설치

 

https://www.apache.org/dyn/closer.cgi/zookeeper/

 

Apache Download Mirrors

<!-- This document is currently not in use, but should be kept in sync with https://www.apache.org/dyn/closer.html for future use --> We suggest the following location for your download: https://dlcdn.apache.org/zookeeper/ Alternate download locations are

www.apache.org

 

위 사이트에서 Zookeeper 다운

최신버전 다운
-bin이 붙은 것으로 다운
압축 풀고, data 폴더 생성
zoo_sample.cfg 복사
이름 변경
dataDir 수정
설치된 위치\data로 지정
cmd로 zkServer.cmd 실행

 

 

 

 

#Kafka 포트 번호 충돌(8080번)이 발생할 경우

8080번 포트 충돌 에러
zoo.cfg 수정

 

 

Kafka 설치

 

https://kafka.apache.org/downloads

 

Apache Kafka

Apache Kafka: A Distributed Streaming Platform.

kafka.apache.org

 

위 사이트에서 Kafka 다운로드

 

최신버전
압축풀고, logs 폴더 생성
server.properties 수정
lod.dirs 수정
생성한 logs 폴더 위치로 지정
kafka-server-start.bat 실행
config\server.properties를 지정해서 사용

 

토픽 생성

# kafka 2.2 이상 버전에서는 --zookeeper 옵션 대신에 --bootstrap-server 옵션을 사용

이미지는 이미 만들었기 때문에 에러 출력됨

로컬 호스트의 Kafka 서버(기본 포트 9092)를 지정

 

토픽 조회

 

 

메세지 송수신

 

1. 메세지 수신자(consumer) 생성

2. 메세지 송신자(producer) 생성

3. 메세지 송신

4. 메세지 수신

 

간단한데 실제로 해보면 좀 신기하다

 

카프카에 대한 정보

https://soft.plusblog.co.kr/3

 

[Kafka] #1 - 아파치 카프카(Apache Kafka)란 무엇인가?

데이터 파이프라인(Data Pipeline)을 구축할 때 가장 많이 고려되는 시스템 중 하나가 '카프카(Kafka)' 일 것이다. 아파치 카프카(Apache Kafka)는 링크드인(LinkedIn)에서 처음 개발된 분산 메시징 시스템이

soft.plusblog.co.kr