zoukankan      html  css  js  c++  java
  • kafka config

    Config parameters that influence the log retention time.

    log.roll.hours  # how long to produce a new log segment.

    log.retention.hours   # delete log file how long ago, only when there are more than 1 log segment files, kafka will delete the old one.

    log.retention.bytes   # trigger log clean thread when log size up to this limit.

    log.segment.bytes  # the max size of log segment, it the max size is reached, new segment will be create, default is 1G.

    log delete policy will be triggered once one of the the log.retention.hours and log.retention.bytes is meet or both of them are meet.

    only set log.retention.hours to some value could not ensure the message in kafka be deleted after the set value.

    if the log clean condition is satisfied, kafka will delete or compact the old one, only if there are more than 1 log segment file.

    then, how to pooduce new log segment file?

    1.set log.roll.hours to a value less than log.retention.hours, this ensures there will be a new log segment when log.retention.hours is meet.

    ps: set log.segment.bytes to a relatively small value, kafka will create new log segment when the segment size is larger than the set value, this not ensure log which is expired could be deleted, because of the case that messages may be not enough to full a log segment file even the log.segment.bytes is set to a relative small value.

    if the log.retention.hours needs precision control, the log.roll.hours should be at a fraction of the log.retention.hours, and log.segment.delete.delay.ms should be set to 0(default is 6000 ms), log.retention.check.interval.ms should be set to a small value(default is 300000ms, too small check interval is not recomment, it will cost too many resources to do it.)

    Finally, if the log 10 hours ago should be cleaned, what the config should be?

    log.roll.hours = 5  # this ensure there will be more than 1 file, when log.retention.hours is meet, and the cleaner therad is triggered. other values such as 1, 2 also works.

    log.retention.hours = 10  # this controls the log retention time.

    if the log.roll.hours is larger than 10, there will be only 1 file after 10 hours pased, and kafka will not delete the log which exist longer than retention hours.

  • 相关阅读:
    js数据类型转换
    html5的onhashchange和history历史管理
    Javascript语言精粹-毒瘤和糟粕
    [夏天Object]运行时程序执行的上下文堆栈(一)
    [Object]继承(经典版)(五)封装
    [Object]继承(经典版)(四)多重继承和组合继承
    flex 弹性布局的大坑!!
    带视觉差的轮播图
    不用循环的数组求和
    CSS3盒模型display:box简述
  • 原文地址:https://www.cnblogs.com/buxizhizhoum/p/8900393.html
Copyright © 2011-2022 走看看