kakfa 开发-01

kafka 开发梳理

使用内置的zoookeeper启动

    bin/zookeeper-server-start.sh  config/zookeeper.properties

tips: 出现0.0.0.0/0.0.0.0:2181表示启动成功了!

启动kafka

   bin/kafka-server-start.sh config/server.properties

tips: 出现INFO Kafka commitId: asdfbasdcc121/Started 表示启动kafka成功了

启动一个TOPIC

   bin/kafka-topics.sh --create --zookeeper localhost:2181 --topic test --partitions 1 --replication-factor 1

tips Created topic "test"

创建一个Producer

    bin/kafka-console-producer --broker-list localhost:9092 --topic test 

创建一个Consumer

    bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test
    --from-beginning --zookeeper lacolhost:2181

查看Topic 是否创建成功

    bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
原文地址:https://www.cnblogs.com/fandong90/p/10091221.html