• Kafka常用操作备忘


    启动
    nohup ./bin/zookeeper-server-start.sh config/zookeeper.properties &
    nohup ./bin/kafka-server-start.sh config/server.properties &

    创建topic
    kafka-topics.sh --create --zookeeper localhost:2181/kafka --replication-factor 1 --partitions 1 --topic $TOPIC

    topic状态
    ./kafka-topics.sh --describe --zookeeper localhost:2181 --topic test

    topic列表
    ./kafka-topics.sh --list --zookeeper localhost:2181

    限流(根据每秒字节数)
    kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'producer_byte_rate=24576000,consumer_byte_rate=24576000' --entity-type clients --entity-default
    ./kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'producer_byte_rate=1024' --entity-type clients --entity-default
    .kafka-configs.sh --zookeeper localhost:2181 --alter --add-config 'producer_byte_rate=1536000'--entity-type clients --entity-default

    消费状态
    ./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group group_name

    生产消费
    kafka-console-producer.sh --broker-list localhost:9092 --topic test
    kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

    动态增加副本:
    ./bin/kafka-reassign-partitions.sh --zookeeper localhost:2181/kafka --reassignment-json-file increase-replication-factor.json --execute
    {"version":1,"partitions":[{"topic":"foo","partition":0,"replicas":[5,6,7]}]}

    reassign检验:

    kafka-reassign-partitions.sh --zookeeper localhost:2181 --reassignment-json-file increase-replication-factor.json --verify

    jstack -l pid

    jmap -dump:live,format=b,file=/opt/map.bin pid

    jps|grep Kafka|awk '{print $1}'|xargs kill -9

  • 相关阅读:
    leetcode python翻转字符串里的单词
    leetcode python快乐数
    Usb gadget驱动
    cnblogs的第一篇
    python返回函数+匿名函数+装饰器+偏函数
    1144. 递减元素使数组呈锯齿状
    208. Implement Trie (Prefix Tree)
    3. Longest Substring Without Repeating Characters
    5. Longest Palindromic Substring :manacher
    929. 独特的电子邮件地址
  • 原文地址:https://www.cnblogs.com/showing/p/9856015.html
Copyright © 2020-2023  润新知