Created
April 5, 2022 18:44
-
-
Save StephanyBatista/97e2884308a61b2fa67815cae9d41f41 to your computer and use it in GitHub Desktop.
Kafka compose
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: '3' | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:latest | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
kafka: | |
image: confluentinc/cp-kafka:latest | |
depends_on: | |
- zookeeper | |
ports: | |
- "9092:9092" | |
- "9094:9094" | |
environment: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | |
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | |
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL | |
KAFKA_LISTENERS: INTERNAL://:9092,OUTSIDE://:9094 | |
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,OUTSIDE://host.docker.internal:9094 | |
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT | |
extra_hosts: | |
- "host.docker.internal:172.17.0.1" | |
kafka-topics-generator: | |
image: confluentinc/cp-kafka:latest | |
depends_on: | |
- kafka | |
command: > | |
bash -c | |
"sleep 5s && | |
kafka-topics --create --topic=transactions --if-not-exists --bootstrap-server=kafka:9092 && | |
kafka-topics --create --topic=transaction_confirmation --if-not-exists --bootstrap-server=kafka:9092 && | |
kafka-topics --create --topic=bank001 --if-not-exists --bootstrap-server=kafka:9092 && | |
kafka-topics --create --topic=bank002 --if-not-exists --bootstrap-server=kafka:9092" | |
control-center: | |
image: confluentinc/cp-enterprise-control-center:6.0.1 | |
hostname: control-center | |
depends_on: | |
- kafka | |
ports: | |
- "9021:9021" | |
environment: | |
CONTROL_CENTER_BOOTSTRAP_SERVERS: 'kafka:9092' | |
CONTROL_CENTER_REPLICATION_FACTOR: 1 | |
PORT: 9021 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment