赞
踩
docker部署bitnami/kafka 可以先去docker 仓库 下载最新docker-compose.yaml 附上我用的
- version: "2"
-
- services:
- zookeeper:
- image: docker.io/bitnami/zookeeper:3.7
- container_name: zookeeper
- ports:
- - "2181:2181"
- volumes:
- - "zookeeper_data:/D/program/Git/home/share"
- environment:
- - ALLOW_ANONYMOUS_LOGIN=yes
- kafka:
- image: docker.io/bitnami/kafka:3
- container_name: kafka
- ports:
- - "9092:9092"
- volumes:
- - "kafka_data:/D/program/Git/home/share"
- environment:
- - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- - ALLOW_PLAINTEXT_LISTENER=yes
- depends_on:
- - zookeeper
-
- volumes:
- - /var/run/docker.sock:/var/run/docker.sock
- volumes:
- zookeeper_data: {}
- kafka_data: {}
执行 docker-compose up -d 可以自己下载并运行
外部用Java 等程序连接 docker 中的Kafka 需要先配置 host
猜测是因为Kafka 返回的验证信息host是容器名字 Java端不能识别
192.168.99.101 a7ed25aa5ed0
前边是容器的 IP 后面是容器的 id 不配置会出现 unknown host name
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。