분산 이벤트 저장 stream 처리 플랫폼
pub-sub모델의 Message queue
Apache Software Foundation에서 Java와 Scala를 이용해 개발한 오픈 소스 시스템
내가 사용한 OS 👉 Windows11
⚙️ Install
https://www.apache.org/dyn/closer.cgi?path=/kafka/3.3.1/kafka_2.13-3.3.1.tgz
Apache Downloads
We suggest the following site for your download: https://dlcdn.apache.org/kafka/3.3.1/kafka_2.13-3.3.1.tgz Alternate download locations are suggested below. It is essential that you verify the integrity of the downloaded file using the PGP signature (.asc
www.apache.org
Kafka 압축 해제 및 해당 폴더로 이동
tar -xzf kafka_2.13-3.3.1.tgz
$ cd kafka_2.13-3.3.1
터미널을 총 4개 열었다.
1. Zookeeper service
2. Kafka broker service
3. broker
4. consumer
아래의 과정을 따라하면 된다.
Kafka 사용 준비
bin\windows\zookeeper-server-start.bat config\zookeeper.properties
Zookeeper service 시작
만약에 입력 줄이 너무 깁니다. 명령 구문이 올바르지 않습니다. 라는 에러가 뜬다면, C:\my\kafka_2.12-3.7.0 \kafka_2.12-3.7.0 ➡ C:\my\kafka_2.12-3.7.0와 같이 변경한다.
bin\windows\kafka-server-start.bat config\server.properties
새로운 터미널을 연다.
Zookeeper 서버가 뜬 후에 실행시켜야 한다.
Kafka broker service 시작
이벤트를 저장할 Topic 생성
bin\windows\kafka-topics.bat --create --topic quickstart-events --bootstrap-server localhost:9092
새로운 터미널을 연다.
Topic에 이벤트 저장
bin\windows\kafka-console-producer.bat --topic quickstart-events --bootstrap-server localhost:9092
This is my first event
This is my second event
ctrl-c를 입력하면 중단
이벤트 읽기
bin\windows\kafka-console-consumer.bat --topic quickstart-events --from-beginning --bootstrap-server localhost:9092
새로운 터미널을 연다.
참고 👇
https://kafka.apache.org/quickstart
Apache Kafka
Apache Kafka: A Distributed Streaming Platform.
kafka.apache.org