美文网首页
kafka 操作

kafka 操作

作者: 尚无花名 | 来源:发表于2019-06-16 01:08 被阅读0次

    start zookeeper
    zookeeper-server-start.sh config/zookeeper.properties
    start kafa
    kafka-server-start.sh config/server.properties

    Delete a topic,
    kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic second-topic --delete
    List topics
    kafka-topics.sh --zookeeper 127.0.0.1:2181 --list
    create topic
    kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic second-topic --create --partitions 6 --replication-factor 1
    describe a topic
    kafka-topics.sh --zookeeper 127.0.0.1:2181 --topic first_topic --describe

    produce a message from the console
    kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic first_topic

    kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic first_topic --producer-property acks=all

    Consumer:
    kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic first_topic
    kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic first_topic --from-beginning

    kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic first_topic --group my-first-application

    Consumer groups
    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group my-third-application

    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-first-application --reset-offsets --shift-by -2 --execute --topic first_topic
    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-first-application --reset-offsets --to-earliest --execute --topic first_topic

    相关文章

      网友评论

          本文标题:kafka 操作

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