Docker:Kafka安装:修订间差异

来自WHY42
Riguz留言 | 贡献
无编辑摘要
Riguz留言 | 贡献
无编辑摘要
 
第42行: 第42行:


客户端(kafka tool)中需要设置bootstrap server为localhost:9093
客户端(kafka tool)中需要设置bootstrap server为localhost:9093
<syntaxhighlight lang="bash">
./kafka-topics.sh --bootstrap-server 127.0.0.1:9093 --list
</syntaxhighlight>


* https://github.com/bitnami/bitnami-docker-kafka
* https://github.com/bitnami/bitnami-docker-kafka


[[Category:Docker]]
[[Category:Docker]]

2021年11月23日 (二) 01:45的最新版本

注意如果从docker外部连接的话需要增加额外的配置,如下:

version: "2"

services:
  zookeeper:
    image: docker.io/bitnami/zookeeper:3.7
    ports:
      - "2181:2181"
    volumes:
      - "zookeeper_data:/bitnami"
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  kafka:
    image: docker.io/bitnami/kafka:3
    ports:
      - "9093:9093"
    volumes:
      - "kafka_data:/bitnami"
    mem_limit: 4096M
    mem_reservation: 1024M
    cpus: 4
    environment:
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_HEAP_OPTS=-Xmx3072m -Xms1024m
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT
      - KAFKA_CFG_LISTENERS=CLIENT://:9092,EXTERNAL://:9093
      - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://localhost:9093
      - KAFKA_INTER_BROKER_LISTENER_NAME=CLIENT
    depends_on:
      - zookeeper

volumes:
  zookeeper_data:
    driver: local
  kafka_data:
    driver: local

客户端(kafka tool)中需要设置bootstrap server为localhost:9093

 ./kafka-topics.sh --bootstrap-server 127.0.0.1:9093 --list