1

本文简单介绍下docker运行kafka以及kafka manager

镜像

docker pull dockerkafka/zookeeper
docker pull dockerkafka/kafka
docker pull dockerkafka/kafka-manager

启动

docker run -it --rm --name kafkadocker_zookeeper_1 -p 2181:2181 dockerkafka/zookeeper

docker run -it --rm --name kafkadocker_kafka_1 --link kafkadocker_zookeeper_1:zookeeper -p 9092:9092 dockerkafka/kafka

docker run -it --rm --link kafkadocker_zookeeper_1:zookeeper --link kafkadocker_kafka_1:kafka -p 9000:9000 -e ZK_HOSTS=zookeeper:2181 dockerkafka/kafka-manager

也可以compose启动

zookeeper:
  image: dockerkafka/zookeeper
  ports:
   - "2181:2181"
   - "2888:2888"
   - "3888:3888"
   - "5000:5000"

kafka:
  image: dockerkafka/kafka
  ports:
    - "9092:9092"
  links:
    - zookeeper:zookeeper

kafka-manager:
  image: dockerkafka/kafka-manager
  environment:
  - ZK_HOSTS=zookeeper:2181
  ports:
    - "9000:9000"
  links:
    - zookeeper:zookeeper
    - kafka:kafka
  volumes:
    - ./image/conf:/opt/kafka-manager-1.2.7/conf

访问

192.178.99.100:9000,然后添加cluster即可,其中zk地址填写zookeeper:2181

bug,明明docker是kafka0.9的,这个manager界面确只有0.8版本的可供选择

doc


codecraft
11.9k 声望2k 粉丝

当一个代码的工匠回首往事时,不因虚度年华而悔恨,也不因碌碌无为而羞愧,这样,当他老的时候,可以很自豪告诉世人,我曾经将代码注入生命去打造互联网的浪潮之巅,那是个很疯狂的时代,我在一波波的浪潮上留下...