美文网首页
Kafka on docker

Kafka on docker

作者: 望山不是山 | 来源:发表于2021-06-29 15:41 被阅读0次
    • Install zookeeper
    1. Download zk
    docker pull wurstmeister/zookeeper
    
    1. Start zk
    docker run --network db_network -d --name zookeeper --publish 2181:2181 --volume /etc/localtime:/etc/localtime wurstmeister/zookeeper
    
    • Install kafka
    1. Download kafka
    docker pull wurstmeister/kafka
    
    1. Start kafka
    docker run --network db_network -d --name kafka --publish 9092:9092 --link zookeeper --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 --env KAFKA_ADVERTISED_HOST_NAME=kafka --env KAFKA_ADVERTISED_PORT=9092 --volume /etc/localtime:/etc/localtime wurstmeister/kafka:latest
    
    • Verify
    $ kafka-topics.sh --zookeeper zookeeper:2181 --list
    $ kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 3 --topic binlog_test
    $ kafka-console-producer.sh --broker-list localhost:9092 --topic binlog_test
    $ kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic binlog_test --from-beginning
    

    相关文章

      网友评论

          本文标题:Kafka on docker

          本文链接:https://www.haomeiwen.com/subject/gsqkultx.html