• kafka删除主题数据和删除主题


    1、删除主题

    在server.properties中增加设置,默认未开启
    delete.topic.enable=true  

    删除主题命令

    /bin/kafka-topics --delete --topic test --zookeeper localhost:2181  

    2、删除主题数据

    如果想保留主题,只删除主题现有数据(log)。可以通过修改数据保留时间实现
    bin/kafka-configs --zookeeper localhost:2181 --entity-type topics --entity-name test --alter --add-config retention.ms=3000  
    ### 修改保留时间为三秒,但不是修改后三秒就马上删掉,kafka是采用轮训的方式,轮训到这个主题发现三秒前的数据都是删掉。时间由自己在server.properties里面设置,设置见下面。  

    数据删除后,继续使用主题,那主题数据的保留时间就不可能为三秒,所以把上面修改的配置删掉,采用server.properties里面统一的配置。

    bin/kafka-configs --zookeeper localhost:2181 --entity-type topics --entity-name test --alter --delete-config retention.ms  
     server.properties里面数据保留时间的配置
    log.retention.hours=168  //保留时间,单位小时  
    log.retention.check.interval.ms=300000 //保留时间检查间隔,单位毫秒  

    ref: https://blog.csdn.net/forrest_ou/article/details/78999983

     
  • 相关阅读:
    asp.net 下载文件
    Asp.Net中用iframe解决模态窗口文件下载问题(转)
    如何获取网站的根目录(js或者asp.net)
    java中日期加减计算(转)
    网页颜色选择器
    信仰基督教的好处
    基因芯片数据字段
    独立分量分析(ICA)
    GenePix® Pro 文件格式
    OBO文件中的标签的含义/意思/意义
  • 原文地址:https://www.cnblogs.com/chenzechao/p/9011389.html
Copyright © 2020-2023  润新知