Last active
October 5, 2023 02:24
-
-
Save gotoweb/d597fbfa4697aee960fca034daedb6ca to your computer and use it in GitHub Desktop.
simple kafka
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
environment: | |
ZOOKEEPER_SERVER_ID: 1 | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
ZOOKEEPER_INIT_LIMIT: 5 | |
ZOOKEEPER_SYNC_LIMIT: 2 | |
ports: | |
- "22181:2181" | |
kafka: | |
image: confluentinc/cp-kafka:latest | |
depends_on: | |
- zookeeper | |
ports: | |
- "9092:9092" | |
- "29092:29092" | |
environment: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' | |
KAFKA_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://kafka:9092 | |
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092 | |
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT | |
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL | |
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | |
# (homebrew 기준, brew install kakfa) | |
# 토픽 목록 조회 /opt/homebrew/bin/kafka-topics --list --bootstrap-server localhost:9092 | |
# 메시지 발행 /opt/homebrew/bin/kafka-console-producer --bootstrap-server localhost:9092 --topic hello | |
# 메시지 소비 /opt/homebrew/bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment