kafka 日志滚动配置

kafka 定时删除数据

kafka 删除数据其实删除其日志,kafka 的数据其实是kafka 的message 固化到硬盘形成的,她允许配置成一定的策略来删除数据,。

数据删除的方式:首先进入kafka的安装目录,找到其中的config文件夹,然后进入,在里面找到server.properties 文件, 编辑该文件 vi server.properties

操作如下:

cd /usr/oozie

cd config

vi server.properties 

 

在文件中找到 如下文件,

############################# Log Retention Policy #############################

# The following configurations control the disposal of log segments. The policy can
# be set to delete segments after a period of time, or after a given size has accumulated.
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
# from the end of the log.

# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168

# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
#log.retention.bytes=1073741824

# The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=1073741824

# The interval at which log segments are checked to see if they can be deleted according
# to the retention policies
log.retention.check.interval.ms=300000


从上面的选项中,可以看到这几个可以设置的地方

/* 数据可以保留的最大时长, 达到这个时长的时候, 会删除数据 */

log.retention.hours=168

/* 数据保留的最大值, 达到这个值, 会删除这个数据 */ 

log.segment.bytes=1073741824    

/* 当一个日志块达到指定的值时,会创建新的日块*/

log.segment.bytes=1073741824

/* 检查每个日志块的时间间隔 */

log.retention.check.interval.ms=300000


为了避免在删除时阻塞读操作,采用了copy-on-write形式的实现,删除操作进行时,读取操作的二分查找功能实际是在一个静态的快照副本上进行的

文章也会在公众号更新,欢迎关注!

公众号

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值