docker安装kafka

Published on with 10 views and 0 comments
  1. 下载zookeeper
docker pull wurstmeister/zookeeper
  1. 下载kafka
docker pull wurstmeister/kafka
  1. 定义docker-compose.yml
version: '3'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka
    depends_on: [ zookeeper ]
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: x.x.x.x
      KAFKA_CREATE_TOPICS: "test:1:1"
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
    volumes:
      - /data/product/zj_bigdata/data/kafka/docker.sock:/var/run/docker.sock
  1. 在docker-compose.yml文件目录进行服务打包
[root@VM_0_16_centos kafka] # docker-compose build
zookeeper uses an image, skipping
kafka uses an image, skipping
  1. 启动服务
[root@VM_0_16_centos kafka]# docker-compose up -d
Starting kafka_kafka_1     ... done
Starting kafka_zookeeper_1 ... done
  1. kafka集群管理界面
docker run -itd --name=kafka-manager -p 9000:9000 -e ZK_HOSTS="x.x.x.x:2181" sheepkiller/kafka-manager

标题:docker安装kafka
作者:weiweihaha
地址:http://blog.lijida.cn/articles/2019/11/13/1573632797374.html