运维八一 运维八一
首页
运维杂记
编程浅尝
周积跬步
专栏
生活
关于
收藏
  • 分类
  • 标签
  • 归档
Source (opens new window)

运维八一

运维,运维!
首页
运维杂记
编程浅尝
周积跬步
专栏
生活
关于
收藏
  • 分类
  • 标签
  • 归档
Source (opens new window)
  • 操作系统

  • 域名解析

  • 公有云

  • CI&CD

  • 数据库

  • 负载均衡&反向代理

  • 存储系统

  • 容器&容器编排

  • 批量管理

  • 邮件系统

  • 监控系统

  • Web服务

  • 虚拟化

  • 防火墙

  • 压测

  • 文件同步

  • 私有云

  • 日志系统

    • ELK
    • ELK-filebeat安装说明
    • ELK安装问题
    • loki问题
    • 代码仓库&版本管理

    • 安全审计

    • 远程拨号

    • 大数据

    • 统一认证

    • 消息队列

    • Apollo

    • 运维杂记
    • 日志系统
    lyndon
    2024-01-05
    目录

    loki问题

    # filetarget.fsnotify.NewWatcher: too many open files

    报错信息:level=error ts=2024-01-04T07:02:47.637495247Z caller=filetargetmanager.go:265 msg="Failed to create target" key="{app="xxx", container="xxx", job="default/xxx", namespace="default", pod="xxx-57988fb6db-q59zz", pod_template_hash="57988fb6db"}" error="filetarget.fsnotify.NewWatcher: too many open files"

    问题分析:loki部署在k8s集群中,集群里有一些也容器产生的日志文件特别多,导致loki需要watcher的文件数过多,inotify数量不足

    网上搜了一下,这一篇比较靠谱,记录一下。原文链接:https://www.jianshu.com/p/337946a30013

    问题描述

    level=info ts=2021-01-21T01:56:05.301932147Z caller=server.go:225 http=[::]:9080 grpc=[::]:41303 msg="server listening on addresses"
    level=info ts=2021-01-21T01:56:05.302278747Z caller=main.go:108 msg="Starting Promtail" version="(version=2.0.0, branch=HEAD, revision=6978ee5d7)"
    level=info ts=2021-01-21T01:56:10.30212042Z caller=filetargetmanager.go:261 msg="Adding target" key="{log_from=\"static_pods\"}"
    level=error ts=2021-01-21T01:56:10.302202345Z caller=filetargetmanager.go:265 msg="Failed to create target" key="{log_from=\"static_pods\"}" error="filetarget.fsnotify.NewWatcher: too many open files"
    
    1
    2
    3
    4

    解决办法

    # 在宿主机执行
    sudo sysctl -w fs.inotify.max_user_instances=512
    
    1
    2

    参考文档

    • https://github.com/grafana/loki/issues/1153 (opens new window)
    • https://unix.stackexchange.com/questions/444998/how-to-set-and-understand-fs-notify-max-user-watches (opens new window)
    上次更新: 2024/01/05, 15:56:02
    ELK安装问题
    git常用命令

    ← ELK安装问题 git常用命令→

    最近更新
    01
    ctr和crictl显示镜像不一致
    03-13
    02
    alpine镜像集成常用数据库客户端
    03-13
    03
    create-cluster
    02-26
    更多文章>
    Theme by Vdoing | Copyright © 2015-2024 op81.com
    苏ICP备18041258号-2
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式