Skip to content

Instantly share code, notes, and snippets.

@seglo
Last active January 22, 2020 07:30
Show Gist options
  • Save seglo/8e333128a2938820c8eb3e08a2517167 to your computer and use it in GitHub Desktop.
Save seglo/8e333128a2938820c8eb3e08a2517167 to your computer and use it in GitHub Desktop.
user-events kafka cluster
# See dockerhub for different versions of kafka and zookeeper:
# https://hub.docker.com/r/wurstmeister/kafka/
# https://hub.docker.com/r/wurstmeister/zookeeper/
# Usage notes:
# https://github.com/wurstmeister/kafka-docker/
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper:3.4.6
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka:2.12-2.4.0
ports:
- "9094:9094"
environment:
HOSTNAME_COMMAND: "docker info | grep ^Name: | cut -d' ' -f 2"
PORT_COMMAND: "docker port `hostname` 9094 | cut -d: -f 2"
KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://_{HOSTNAME_COMMAND}:_{PORT_COMMAND}
KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_CREATE_TOPICS: "user-events:128:1"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@seglo
Copy link
Author

seglo commented Jan 21, 2020

Notes

  • Runs on Ubuntu, not tested on MacOS
  • Creates user-events topic with 128 partitions
  • External port is 9094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment