Docker-compose安装Kafka

1.配置文件

docker-compose配置文件

image-20220702152053882
version: '3.0'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka
    container_name: kafka
    volumes:
      - /etc/localtime:/etc/localtime
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      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
    container_name: kafka-manager
    environment:
      ZK_HOSTS: 127.0.0.1
    ports:
      - "9009:9000"

安装后:

image-20220702152149707

image-20220702152224570

2.内网安装

# 保存镜像
docker save -o kafka.tar wurstmeister/kafka
docker save -o zookeeper.tar wurstmeister/zookeeper 
docker save -o kafka-manager.tar sheepkiller/kafka-manager

# 加载镜像
docker load -i kafka.tar
docker load -i zookeeper.tar
docker load -i kafka-manager.tar

# 启动镜像
docker-compose up -d --build

image-20220703111210998

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐