Skip to content

Instantly share code, notes, and snippets.

@mhowlett
Last active March 16, 2024 18:50
Show Gist options
  • Save mhowlett/14f70af1a5b44fba80c9d1857a44bb98 to your computer and use it in GitHub Desktop.
Save mhowlett/14f70af1a5b44fba80c9d1857a44bb98 to your computer and use it in GitHub Desktop.
Brings up a kafka cluster using Docker for Mac. Usage: MY_IP=<your ip> docker-compose up
---
version: '2'
services:
zk1:
image: confluentinc/cp-zookeeper:3.0.1
ports:
- "22181:22181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 22181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zk1:22888:23888;zk2:32888:33888;zk3:42888:43888
zk2:
image: confluentinc/cp-zookeeper:3.0.1
ports:
- "32181:32181"
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zk1:22888:23888;zk2:32888:33888;zk3:42888:43888
zk3:
image: confluentinc/cp-zookeeper:3.0.1
ports:
- "42181:42181"
environment:
ZOOKEEPER_SERVER_ID: 3
ZOOKEEPER_CLIENT_PORT: 42181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: zk1:22888:23888;zk2:32888:33888;zk3:42888:43888
kafka-1:
image: confluentinc/cp-kafka:3.0.1
ports:
- "19092:19092"
depends_on:
- zk1
- zk2
- zk3
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: ${MY_IP}:22181,${MY_IP}:32181,${MY_IP}:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${MY_IP}:19092
kafka-2:
image: confluentinc/cp-kafka:3.0.1
ports:
- "29092:29092"
depends_on:
- zk1
- zk2
- zk3
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: ${MY_IP}:22181,${MY_IP}:32181,${MY_IP}:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${MY_IP}:29092
kafka-3:
image: confluentinc/cp-kafka:3.0.1
ports:
- "39092:39092"
depends_on:
- zk1
- zk2
- zk3
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: ${MY_IP}:22181,${MY_IP}:32181,${MY_IP}:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${MY_IP}:39092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment