74 lines
2.9 KiB
YAML
74 lines
2.9 KiB
YAML
version: '3.8'
|
|
services:
|
|
# Single-node KRaft (broker+controller) Kafka using Confluent image
|
|
kafka:
|
|
image: confluentinc/cp-kafka:8.0.0
|
|
ports:
|
|
- "9092:9092" # internal clients inside docker network can use kafka:9092
|
|
- "9050:29092" # host clients can use host:9050 (mapped from container 29092). Use any allowed host port 9050-9059.
|
|
environment:
|
|
# KRaft combined node
|
|
KAFKA_NODE_ID: "1"
|
|
KAFKA_PROCESS_ROLES: "broker,controller"
|
|
# fixed cluster id (keeps data directory compatible across restarts for this single-node test)
|
|
KAFKA_CLUSTER_ID: "MkU3OEVBNTcwNTJENDM2Qk"
|
|
CLUSTER_ID: "MkU3OEVBNTcwNTJENDM2Qk"
|
|
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
|
|
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093"
|
|
# listeners: internal plaintext for inter-broker, external SASL_PLAINTEXT for host access, controller for KRaft
|
|
KAFKA_LISTENERS: "INTERNAL://0.0.0.0:9092,EXTERNAL://0.0.0.0:29092,CONTROLLER://0.0.0.0:9093"
|
|
# Advertise the host IP so remote clients can reach the broker
|
|
KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:9092,EXTERNAL://localhost:9050,CONTROLLER://kafka:9093"
|
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:SASL_PLAINTEXT,CONTROLLER:PLAINTEXT"
|
|
KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
|
|
KAFKA_SASL_ENABLED_MECHANISMS: "SCRAM-SHA-256,SCRAM-SHA-512"
|
|
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: "SCRAM-SHA-512"
|
|
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: "1"
|
|
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: "1"
|
|
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: "1"
|
|
KAFKA_OPTS: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf"
|
|
volumes:
|
|
- ./kafka_server_jaas.conf:/etc/kafka/kafka_server_jaas.conf:ro
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
restart: unless-stopped
|
|
ports:
|
|
- "6579:6379"
|
|
volumes:
|
|
- ./redis/data:/data
|
|
command: ["redis-server", "--appendonly", "yes"]
|
|
|
|
clickhouse:
|
|
image: clickhouse/clickhouse-server:latest
|
|
depends_on:
|
|
- kafka
|
|
ulimits:
|
|
nofile:
|
|
soft: 262144
|
|
hard: 262144
|
|
ports:
|
|
- "8123:8123" # HTTP
|
|
- "9000:9000" # Native
|
|
- "9009:9009" # TCP for interserver (optional)
|
|
volumes:
|
|
- ./clickhouse_data:/var/lib/clickhouse
|
|
# mount a users.d directory so we can set a default user's password/config
|
|
- ./clickhouse_config/users.d:/etc/clickhouse-server/users.d:ro
|
|
|
|
grafana:
|
|
image: grafana/grafana:latest
|
|
restart: unless-stopped
|
|
environment:
|
|
GF_INSTALL_PLUGINS: vertamedia-clickhouse-datasource,hamedkarbasi93-kafka-datasource
|
|
# Optional: set admin password via GF_SECURITY_ADMIN_PASSWORD
|
|
GF_SECURITY_ADMIN_PASSWORD: Admin_Hexiaoniu1
|
|
ports:
|
|
- "3011:3000"
|
|
volumes:
|
|
- ./grafana:/var/lib/grafana
|
|
- ./grafana/provisioning:/etc/grafana/provisioning:ro
|
|
depends_on:
|
|
- clickhouse
|