Last active
November 4, 2024 21:17
-
-
Save jose16-21/212082691f8499b216c95e4da8e6f8d1 to your computer and use it in GitHub Desktop.
docker-compose apache kafka
This file contains hidden or 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: '3' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:7.0.1 | |
container_name: zookeeper | |
restart: always | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ZOOKEEPER_TICK_TIME: 2000 | |
kafka: | |
image: confluentinc/cp-kafka:7.0.1 | |
container_name: kafka | |
restart: always | |
ports: | |
- "9092:9092" | |
depends_on: | |
- zookeeper | |
environment: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181' | |
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT | |
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,PLAINTEXT_INTERNAL://localhost:29092 | |
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | |
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | |
networks: | |
default: | |
external: | |
name: dev-network | |
# | |
# docker exec -it kafka bash | |
# kafka-topics --create --topic mi-topic --bootstrap-server kafka:9092 --partitions 1 --replication-factor 1 | |
# kafka-topics --list --bootstrap-server localhost:9092 | |
# echo "Este es un mensaje de prueba" | kafka-console-producer --broker-list localhost:9092 --topic mi-topic | |
# kafka-topics --delete --topic mi-topic --bootstrap-server kafka:9092 | |
# /bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic mi-topic | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment