kafka的一些坑
kafka标准端口
kafka:
image: wurstmeister/kafka
depends_on: [ zookeeper ]
ports:
- "9092:9092"
environment:
KAFKA_CREATE_TOPICS: "dev:1:1"
KAFKA_JVM_PERFORMANCE_OPTS: " -Xmx256m -Xms256m"
KAFKA_HEAP_OPTS: "-Xmx256M -Xms128M"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_ADVERTISED_PORT: 9092
KAFKA_ADVERTISED_HOST_NAME: 47.80.235.112
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_BROKER_ID: 1
KAFKA_MESSAGE_MAX_BYTES: "2147483647"
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
#- ./server.properties:/kakfa/config/server.properties
container_name: kafka
hostname: kafka
networks:
- dbbackend
kafka非标准端口
version: "3"
services:
zookeeper:
image: wurstmeister/zookeeper:3.4.6
restart: always
hostname: zookeeper
environment:
ZOO_MY_ID: 1
ports:
- 2183:2181
kafka-zw:
image: wurstmeister/kafka
ports:
- "9093:9093"
environment:
TZ: "Asia/Shanghai"
#KAFKA_CREATE_TOPICS: "test:1:1"
KAFKA_JVM_PERFORMANCE_OPTS: " -Xmx256m -Xms256m"
KAFKA_HEAP_OPTS: "-Xmx256M -Xms128M"
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-test:9093
KAFKA_LISTENERS: PLAINTEXT://:9093 监听端口
KAFKA_ADVERTISED_PORT: 9093 远程客户端连接的端口
KAFKA_ADVERTISED_HOST_NAME: 47.80.235.112 远程客户端连接的地址
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_BROKER_ID: 1
KAFKA_MESSAGE_MAX_BYTES: 2147483647
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
container_name: kafka-zw
hostname: kafka-zw
restart: always
depends_on:
- zookeeper
图形管理工具
kafka-tool