title: KAFKA docker 安装教程
date: 2023-08-30
keywords: KAFKA docker 安装教程
description: KAFKA docker 安装教程
top: false
tags:
- kafka
- dockerCompose
categories: - kafka
version: '3'
services:
zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
volumes:
- ka_zookeeper_data:/data
ports:
- 2182:2181
kafka:
image: wurstmeister/kafka
container_name: kafka
expose:
- 9999
ports:
- 9092:9092
- 9999:9999
environment:
KAFKA_BROKER_ID: 0
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_CREATE_TOPICS: "kafeidou:2:0" #kafka启动后初始化一个有2个partition(分区)0个副本名叫kafeidou的topic
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
JMX_PORT: 9999
volumes:
- kafka_data:/kafka
depends_on:
- zookeeper
kafka-manager:
image: dockerkafka/kafka-manager
container_name: kafka-manager
environment:
- ZK_HOSTS=zookeeper:2181
ports:
- "9000:9000"
links:
- zookeeper:zookeeper
- kafka:kafka
volumes:
kafka_data:
driver: local
ka_zookeeper_data:
driver: local