본문 바로가기

수업 & 공부

docker - zookeeper - KAFKA 참고 (KAFKA CLI)

docker-compose.yml 파일

version: "3"
services:
  zookeeper:
    image: "bitnami/zookeeper:latest"
    ports:
      - "2181:2181"
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  kafka:
    image: "bitnami/kafka:latest"
    ports:
      - "9092:9092"
    environment:
      - KAFKA_BROKER_ID=1
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes

    depends_on:
      - zookeeper

 

 

 

kafka CLI

 

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 CLI 사용하기

언제나 개발하기를 즐기는 개발자 입니다.

akageun.github.io

 

 

[Kafka] 기본 카프카 명령어 (command-line tool)

0. 환경 CentOS7 JDK 11(Java 11) Apache Kafka 3.0.0 1. kafka-topics.sh Topic과 관련된 명령을 실행할 수 있는 쉘 스크립트 파일입니다. Topic이란 RDBMS에서 사용하는 테이블과 비슷하다고 볼 수 있습니다. 토..

veneas.tistory.com

 

 

[kafka] consumer producer key value 확인

카프카는 토픽을 기본으로 파티셔닝을 한다. 하지만 하나의 파티션 안에서 또다른 기준 값이 필요하다면 key를 따로설정해줄수 있다. key 에대한 설정은 기본이 null값이기 때문에, 따로 지정하지

log-laboratory.tistory.com

 

topic list 보기

./bin/kafka-topics.sh \
    --bootstrap-server localhost:9092 \
    --list

topic 생성하기

.bin/kafka-topics.sh \
    --bootstrap-server localhost:9092 \
    --replication-factor 1 \
    --partitions 1 \
    --topic test_topic \
    --create

topic consume

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic test_topic

특정 토픽 produce

bin/kafka-console-producer.sh --topic test_topic --bootstrap-server localhost:9092

 

'수업 & 공부' 카테고리의 다른 글

프록시 패턴 (Proxy Pattern) @Transactional  (0) 2022.11.04
AOP (Aspect Oriented Programming)  (0) 2022.11.03
KAFKA  (0) 2022.10.07
Stream  (0) 2022.10.03
Thread (lambda)  (0) 2022.10.03