代码之家  ›  专栏  ›  技术社区  ›  André

卡夫卡有太多打开的文件,太多的小日志,有很高的ulimit和大约5k个段

  •  2
  • André  · 技术社区  · 6 年前

    它总是让卡夫卡报告“打开的文件太多”。我刚重新开始清理,但大约10分钟后

    lsof | grep cp-kafka | wc -l:
    454225
    

    工艺限制:

    Limit                     Soft Limit           Hard Limit           Units
    Max cpu time              unlimited            unlimited            seconds
    Max file size             unlimited            unlimited            bytes
    Max data size             unlimited            unlimited            bytes
    Max stack size            8388608              unlimited            bytes
    Max core file size        0                    unlimited            bytes
    Max resident set          unlimited            unlimited            bytes
    Max processes             96186                96186                processes
    Max open files            800000               800000               files
    Max locked memory         16777216             16777216             bytes
    Max address space         unlimited            unlimited            bytes
    Max file locks            unlimited            unlimited            locks
    Max pending signals       96186                96186                signals
    Max msgqueue size         819200               819200               bytes
    Max nice priority         0                    0
    Max realtime priority     0                    0
    Max realtime timeout      unlimited            unlimited            us
    

    find | wc -l
    5884
    

    我不明白我在这里做错了什么。

    我在Ubuntu 18.04上安装了汇合kafka deb包。

    • 卡夫卡2.0
    • 每条消息大约500字节
    • 自动创建主题为true

    rw-r--r--  1  2.2K Sep 30 10:03 00000000000000000000.index  
    rw-r--r--  1  1.2M Sep 30 10:03 00000000000000000000.log  
    rw-r--r--  1  3.3K Sep 30 10:03 00000000000000000000.timeindex  
    rw-r--r--  1   560 Sep 30 10:03 00000000000000004308.index  
    rw-r--r--  1  293K Sep 30 10:03 00000000000000004308.log  
    rw-r--r--  1    10 Sep 30 10:03 00000000000000004308.snapshot  
    rw-r--r--  1   840 Sep 30 10:03 00000000000000004308.timeindex  
    rw-r--r--  1   10M Sep 30 10:03 00000000000000005502.index  
    rw-r--r--  1   97K Sep 30 10:04 00000000000000005502.log  
    rw-r--r--  1    10 Sep 30 10:03 00000000000000005502.snapshot  
    rw-r--r--  1   10M Sep 30 10:03 00000000000000005502.timeindex
    

    还在服务器配置中添加了以下行;索引保持最大10Mb

    log.segment.bytes=1073741824
    log.segment.index.bytes=1073741824
    

    顺便说一句,我发送的消息带有过去的时间戳,日志保留期为1000年。

    0 回复  |  直到 6 年前