解决tail命令提示“tail: inotify 资源耗尽,无法使用 inotify 机制,回归为 polling 机制”

报错的原因是 inotify 跟踪的文件数量超出了系统设置的上限值,要是这个问题不经常出现可以使用临时解决方法,或者写入配置文件来永久解决。

临时解决方法:

# 查看 inotify 的相关配置
$ sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 8192
# 临时修改配置(重启后会恢复)
$ sudo sysctl -w fs.inotify.max_user_watches=100000

永久解决方法:

$ echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf
# 重载配置文件,使之马上生效
$ sudo sysctl -p

参考链接:

Error:达到了 inotify 观察数限制 http://www.markjour.com/article/cannot-add-inotify-watch.html

原文地址:https://www.cnblogs.com/imzhi/p/about-tail-inotify-resources-exhausted.html