Docker快速安装kafka

创建zk

docker run -d --name zookeeper-server \
    -e ALLOW_ANONYMOUS_LOGIN=yes \
    bitnami/zookeeper:latest

创建kafka

docker run -d --name kafka-server \
    -p 9092:9092 \
    -e ALLOW_PLAINTEXT_LISTENER=yes \
    -e KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181 \
    -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://192.168.0.101:9092 \
    bitnami/kafka:latest

按实际情况修改KAFKA_CFG_ZOOKEEPER_CONNECT,KAFKA_CFG_ADVERTISED_LISTENERS

你可能感兴趣的:(docker,kafka,容器)