Docker Quick Start
Run a multi-broker Kafka cluster with Pilot using Docker Compose. This setup runs two brokers with rack awareness and replication.
Prerequisites
- Docker and Docker Compose installed
- Port 8080 available
1. Create docker-compose.yml
services:
controller:
image: apache/kafka:latest
container_name: controller
environment:
KAFKA_NODE_ID: 0
KAFKA_PROCESS_ROLES: controller
KAFKA_LISTENERS: CONTROLLER://:9093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 0@controller:9093
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
broker-1:
image: apache/kafka:latest
container_name: broker-1
depends_on: [controller]
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker-1:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 0@controller:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_DEFAULT_REPLICATION_FACTOR: 2
KAFKA_MIN_INSYNC_REPLICAS: 1
KAFKA_BROKER_RACK: rack-a
healthcheck:
test: /opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092
start_period: 15s
interval: 10s
timeout: 10s
retries: 5
broker-2:
image: apache/kafka:latest
container_name: broker-2
depends_on: [controller]
environment:
KAFKA_NODE_ID: 2
KAFKA_PROCESS_ROLES: broker
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker-2:9092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 0@controller:9093
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 2
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_DEFAULT_REPLICATION_FACTOR: 2
KAFKA_MIN_INSYNC_REPLICAS: 1
KAFKA_BROKER_RACK: rack-b
healthcheck:
test: /opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092
start_period: 15s
interval: 10s
timeout: 10s
retries: 5
pilot:
image: calinora/pilot:latest
container_name: pilot
ports:
- "8080:8080"
environment:
KAFKA_BOOTSTRAP_SERVERS: broker-1:9092,broker-2:9092
LOG_LEVEL: INFO
PILOT_EXCLUDE_TOPICS: __consumer_offsets,__transaction_state
depends_on:
broker-1:
condition: service_healthy
broker-2:
condition: service_healthy2. Start the Stack
docker compose up -dPilot will wait for both brokers to be healthy before starting.
3. Access the Dashboard
Open http://localhost:8080 in your browser. You should see both brokers with their rack assignments.
4. Verify Connectivity
# Health check
curl http://localhost:8080/api/v1/health
# Cluster info - should show 2 brokers
curl http://localhost:8080/api/v1/cluster5. Create Test Data
Create topics with replication and produce messages to generate activity:
# Create topics with RF=2 so partitions are spread across both brokers
docker exec broker-1 /opt/kafka/bin/kafka-topics.sh --create \
--topic orders --partitions 6 --replication-factor 2 \
--bootstrap-server localhost:9092
docker exec broker-1 /opt/kafka/bin/kafka-topics.sh --create \
--topic events --partitions 4 --replication-factor 2 \
--bootstrap-server localhost:9092
# Produce messages to generate activity
docker exec broker-1 /opt/kafka/bin/kafka-producer-perf-test.sh \
--topic orders --num-records 10000 \
--record-size 256 --throughput 1000 \
--command-property bootstrap.servers=localhost:9092
docker exec broker-1 /opt/kafka/bin/kafka-producer-perf-test.sh \
--topic events --num-records 5000 \
--record-size 128 --throughput 500 \
--command-property bootstrap.servers=localhost:9092Refresh the dashboard to see topics with activity scores and partition distribution across both brokers.
6. View the Proposal
Click Proposals in the navigation. Pilot first collects about five minutes of measurements. This small cluster is close to balanced, so Pilot may propose no moves.
To see a plan on an uneven cluster with steady traffic, stop this stack (see Cleanup) and run the public demo:
curl -fsSLO https://www.calinora.io/pilot-demo.yaml && docker compose -f pilot-demo.yaml upRemove the demo with docker compose -f pilot-demo.yaml down -v.
Cleanup
docker compose down -vNext Steps
- Quick Start - connect to an existing cluster
- Docker Compose - compose examples with SASL and TLS
- Configuration - environment variables and security