Created
January 3, 2022 05:29
-
-
Save thiagotigaz/6e06df821bb82d009b70c5520dba5a9d to your computer and use it in GitHub Desktop.
Docker Compose Kafka Setup for Local Development
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:latest | |
environment: | |
ZOOKEEPER_CLIENT_PORT: 2181 | |
ports: | |
- 2181:2181 | |
kafka: | |
image: confluentinc/cp-kafka:latest | |
depends_on: | |
- zookeeper | |
ports: | |
- 9092:9092 | |
- 9094:9094 | |
volumes: | |
- ./data/kafka1/data:/var/lib/kafka/data | |
- ./data/kafka1/etc:/etc/kafka | |
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=services --if-not-exists --bootstrap-server=kafka:9092" | |
control-center: | |
image: confluentinc/cp-enterprise-control-center:latest | |
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
@thiagotigaz
i am using this in local env
getting error:-
WARN [AdminClient clientId=adminclient-1] Connection to node 1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
thanx in advance