Skip to content

Instantly share code, notes, and snippets.

@mesmacosta
Created October 19, 2020 19:36
Show Gist options
  • Select an option

  • Save mesmacosta/e302b7996c57ccd1552e1f29854cc30e to your computer and use it in GitHub Desktop.

Select an option

Save mesmacosta/e302b7996c57ccd1552e1f29854cc30e to your computer and use it in GitHub Desktop.
version: "3"
services:
zookeeper-1:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 22181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: localhost:22888:23888;localhost:32888:33888;localhost:42888:43888
network_mode: host
extra_hosts:
- "moby:127.0.0.1"
zookeeper-2:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: localhost:22888:23888;localhost:32888:33888;localhost:42888:43888
network_mode: host
extra_hosts:
- "moby:127.0.0.1"
zookeeper-3:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_SERVER_ID: 3
ZOOKEEPER_CLIENT_PORT: 42181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_SERVERS: localhost:22888:23888;localhost:32888:33888;localhost:42888:43888
network_mode: host
extra_hosts:
- "moby:127.0.0.1"
kafka-1:
image: confluentinc/cp-kafka:latest
network_mode: host
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: localhost:22181,localhost:32181,localhost:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:19092
ports:
- "19092:19092"
extra_hosts:
- "moby:127.0.0.1"
kafka-2:
image: confluentinc/cp-kafka:latest
network_mode: host
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: localhost:22181,localhost:32181,localhost:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:29092
ports:
- "29092:29092"
extra_hosts:
- "moby:127.0.0.1"
kafka-3:
image: confluentinc/cp-kafka:latest
network_mode: host
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: localhost:22181,localhost:32181,localhost:42181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:39092
ports:
- "39092:39092"
extra_hosts:
- "moby:127.0.0.1"
# docker run --net=host --rm confluentinc/cp-kafka:latest kafka-topics --create --topic gcp-audit-logs --partitions 2 --replication-factor 2 --if-not-exists --zookeeper localhost:32181
# docker run --net=host --rm confluentinc/cp-kafka:latest kafka-topics --create --topic gcp-audit-logs-3 --partitions 1 --replication-factor 1 --if-not-exists --zookeeper localhost:32181
# docker run --net=host --rm confluentinc/cp-kafka:latest kafka-topics --describe --topic gcp-audit-logs --zookeeper localhost:32181
# docker run --net=host --rm confluentinc/cp-kafka:latest kafka-topics --list --zookeeper localhost:32181
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment