本次实验环境
- 腾讯云轻量应用服务器一台4C4G 100%CPU
前置准备
安装流程
登录portainer.io http://你的IP:9000
选择你的swarm集群
新建stack
填入stack名称和配置文件内容(默认选择Web editor)
Deploy the stack 部署服务
-
等待完成并查看服务
完整docker-compose.yml
version: "3"
services:
zookeeper:
image: docker.io/bitnami/zookeeper:3.8
ports:
- "2181:2181"
volumes:
- "zookeeper_data:/bitnami"
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: docker.io/bitnami/kafka:3.1
ports:
- "9092:9092"
volumes:
- "kafka_data:/bitnami"
environment:
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
- zookeeper
kafka-map: # admin/admin
container_name: kafka-map
image: dushixiang/kafka-map:latest
depends_on:
- kafka
ports:
- "9093:8080"
volumes:
zookeeper_data:
driver: local
kafka_data:
driver: local
防火墙开启
-
按需开启9093、9092、2181等端口
Kafka服务配置
-
登录Kafka Map ,用户名密码为admin/admin
-
import cluster
-
添加新建kafka集群
-
管理 kafka 集群