docker-compose.yml
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper ## 鏡像
ports:
- "2181:2181" ## 對外暴露的端口號
kafka:
image: wurstmeister/kafka ## 鏡像
volumes:
- /etc/localtime:/etc/localtime ## 掛載位置(kafka鏡像和宿主機器之間時間保持一直)
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 11.11.12.202 ## 修改:宿主機IP
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 ## 卡夫卡運行是基于zookeeper的
KAFKA_ADVERTISED_PORT: 9092
KAFKA_LOG_RETENTION_HOURS: 120
KAFKA_MESSAGE_MAX_BYTES: 10000000
KAFKA_REPLICA_FETCH_MAX_BYTES: 10000000
KAFKA_GROUP_MAX_SESSION_TIMEOUT_MS: 60000
KAFKA_NUM_PARTITIONS: 3
KAFKA_DELETE_RETENTION_MS: 1000
# kafka-manager:
# image: sheepkiller/kafka-manager ## 鏡像:開源的web管理kafka集群的界面
# environment:
# ZK_HOSTS: 11.11.12.202 ## 修改:宿主機IP
# ports:
# - "9001:9000" ## 暴露端口