728x90
작업 환경
OS: Ubuntu
Tool: Intellij
Builder: gradle
Framework: Spring-Boot
Language: Java
KafkaVersion: kafka_2.13
Kafka 설치 및 실행
- zookeeper 실행
# 다운받은 kafka 디렉토리 내에서 실행하였을 때 경로
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/zookeeper-server-start.sh ./config/zookeeper.properties
- kafka-server 실행
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/kafka-server-start.sh ./config/server.properties
- topic 생성 - 이벤트 저장할 주제
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/kafka-topics.sh --create --topic ${원하는topic명:kafka-test} --bootstrap-server ${사용하길 원하는 주소:localhost:9092}
- topic 생성 확인
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/kafka-topics.sh --describe --topic ${topicName:kafka-test} --bootstrap-server ${Address:localhost:9092}
Topic: kafka-test TopicId: JW42CEjhS1qqnwIZ1cvdzQ PartitionCount: 1 ReplicationFactor: 1 Configs:
Topic: kafka-test Partition: 0 Leader: 0 Replicas: 0 Isr: 0
- Producer로 Event 발신
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/kafka-console-producer.sh --topic ${topicName:kafka-test} --bootstrap-server ${Address:localhost:9092}
>This is my first event
- Consumer로 Event수신
xxx@kafka:~/kafka_2.13-3.6.1$ ./bin/kafka-console-consumer.sh --topic ${topicName:kafka-test} --bootstrap-server ${Address:localhost:9092}
Docker로 작업
- Apache Kafka Image Download
docker pull apache/kafka:3.7.0
- Kafka Docker Container 생성 및 실행
docker run -p 9092:9092 apache/kafka:3.7.0
참고
https://kafka.apache.org/quickstart
작업공간
728x90
'Server' 카테고리의 다른 글
[ Caching ] 캐싱 적용 API분석 및 K6를 사용한 성능 테스트 결과 (0) | 2024.08.01 |
---|---|
Lock( 비관적, 낙관적, 분산 )적용 상황 분석 및 테스트 결과 (2) | 2024.07.26 |
[스터디] JPA에 대하여 (0) | 2024.05.25 |
[lombok]RequiredArgsConstructord와 Qualifier (0) | 2024.05.03 |
[Spring] Bean은 어떻게 생성하고 주입할까? (0) | 2024.05.01 |