logging - 尽管 log.retention.hours=168 昨天发送的消息的日志文件不存在
问题描述
昨天我在我的 Ubuntu 18.04.01 服务器版中安装了 Kafka 2.0 并按照 QuickStart 说明和解释,直到成功部署第 7 步:https ://kafka.apache.org/quickstart
今天我发现 /tmp 中没有 kafka-logs- 文件,尽管在相关的 server.properties 文件中直接明确了:
server.properties :
# A comma separated list of directories under which to store log files
log.dirs=/tmp/kafka-logs
# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168
server-1.properties :
# A comma separated list of directories under which to store log files
log.dirs=/tmp/kafka-logs-1
# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168
server-2.properties :
# A comma separated list of directories under which to store log files
log.dirs=/tmp/kafka-logs-2
# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168
尽管成功地跟进了快速入门教程的前七个步骤,为什么会发生这种情况?以及如何保存 Kafka 日志文件,其中包含通过 Kafka 代理在生产者和接收者之间发送的消息?
期待您的帮助。马可
解决方案
Since your log.dirs
is pointing to /tmp
directory, it will wipe everything on system reboot. Same applies for Zookeeper data.dir
also.
Make sure that these directories are not pointing to the tmp
folder.
Also, there is one more attribute log.retention.bytes
along with log.retention.hours
which is useful for log compaction.
It denotes the maximum size of logs before deleting it. By default, it is -1. Hence logs can be retained based on retention time. If it is configured to any specific numbers, beyond that it will delete the logs.
推荐阅读
- mysql - 在数据库中使用循环外键引用
- swift - 如何从应用程序包 I macOS 中的文件中读取数据?
- javascript - Express.js & mongoose:使用 bdhash(异步)设置默认值
- plot - 如何正确声明图例?
- c# - Data.Annotations(如 required 和正则表达式)不适用于某些模型
- c++ - JRTPLib 从多个客户端同时接收数据导致速度变慢
- c++ - C++ 输出与数组对齐
- c++ - 如何从 python c-api 获取真正的字符串到 python 脚本?
- c++ - 检测win32服务创建和删除的最佳方法
- php - 在 php 的 exec 中的 echo 中间添加新行