Kafka 다운로드
https://kafka.apache.org/downloads
Zookeepr, Kafka 서버 구동
- ./bin/zookeeper-server-start.sh ./config/zookeeper.properties
- ./bin/kafka-server-start.sh ./config/server.properties
$KAFKA_HOME ./bin/zookeeper-server-start.sh ./config/zookeeper.properties
$KAFKA_HOME ./bin/kafka-server-start.sh ./config/server.properties
Zookeepr, Kafka 환경설정
- zookeeper.properties
- server.properties
$KAFKA_HOME/config/zookeeper.properties
$KAFKA_HOME/config/server.properties
Kafka Topic
- Kafka Producer에서 메시지를 보내면 저장되는 장소
Kafka Topic 생성
- ./bin/kafka-topics.sh --create --topic [토픽명] --bootstrap-server [kafka서버] --partitions [번호]
$KAFKA_HOME ./bin/kafka-topics.sh --create --topic gugbab-test-events --bootstrap-server localhost:9092 --partitions 1
Kafka Topic 목록 확인
- ./bin/kafka-topics.sh --bootstrap-server [kafka서버] --list
$KAFKA_HOME ./bin/kafka-topics.sh --bootstrap-server localhost:9092 --list
Kafka Topic 정보 확인
- ./bin/kafka-topics.sh --describe --topic [토픽명] --bootstrap-server [kafka서버]
$KAFKA_HOME ./bin/kafka-topics.sh --describe --topic gugbab-test-events --bootstrap-server Localhost:9092
Kafka Producert 실행 (메시지 생산)
- ./bin/kafka-console-producer.sh --broker-list [kafka서버] --topic [토픽명]
$KAFKA_HOME ./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic gugbab-test-events
Kafka Consumer 실행
- ./bin/kafka-console-consumer.sh --bootstrap-server [kafka서버] --topic [토픽명]
$KAFKA_HOME ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic gugbab-test-events --from-beginning
Kafka 사용 예시
'MSA' 카테고리의 다른 글
[MSA]Kafka Connect - Connect Source Example (0) | 2023.05.08 |
---|---|
[MSA]Kafka Connect Start Jdbc Connect Example (0) | 2023.05.06 |
[MSA] Apache Kafka란? Kafka 장단점 (0) | 2023.04.29 |
[MSA] Spring Boot - Feign Client Debug, 예외처리, ErrorDecoder사용 (0) | 2023.04.25 |
[MSA] Spring Boot - Feign Client 란? Rest Api 호출 (0) | 2023.04.24 |