• 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.

  • 相关阅读:
    前端知识 | 一个简单的登录页面包含多少前端基础知识?
    SQLserver查询作业、视图、函数、存储过程中的关键字
    SQL server 数据库备份至服务器本地磁盘和其他服务器磁盘
    Linux(centos)安装vim
    CentOS6 7 8更换阿里yum源
    centos8 最小化安装 无 ifconfig,netstat 的安装
    修改MySQL用户的host属性
    阿里云NTP服务器(国内可用的NTP服务器)
    vCenter Server Appliance(VCSA )7.0 部署指南
    Chrome离线安装包最新版
  • 原文地址:https://www.cnblogs.com/buxizhizhoum/p/8900393.html
Copyright © 2020-2023  润新知