| 
 | 
 
 本帖最后由 huangjianan 于 2019-12-21 10:11 编辑 4 s- G% k# O& \; y$ Q7 \ 
7 R$ a8 p8 p# r! i- s- b* l9 l 
解决tail命令提示“tail: inotify 资源耗尽,无法使用 inotify 机制,回归为 polling 机制”( x! e& Z5 I+ {1 m; p6 ^ 
报错的原因是 inotify 跟踪的文件数量超出了系统设置的上限值,要是这个问题不经常出现可以使用临时解决方法,或者写入配置文件来永久解决。 临时解决方法: # 查看 inotify 的相关配置$ sysctl fs.inotify 
9 X' V" G. y4 W8 |9 m1 Ufs.inotify.max_queued_events = 163848 I: @8 Q: |# p1 B) ?; J  `# X 
fs.inotify.max_user_instances = 128 
9 S/ }8 G- `  b' H* x. F( Jfs.inotify.max_user_watches = 81923 C2 d; T: @* B3 Z1 Z 
# 临时修改配置(重启后会恢复), Z6 m+ h4 _) g 
$ sudo sysctl -w fs.inotify.max_user_watches=1000006 t! d8 m3 L3 E) @9 @; W' Y. @# a- D 
- C. n2 A3 A2 x4 t, a- S% B 
永久解决方法: 
7 N/ l4 o& p: G1 d* M% f$ echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf$ X* u) @- l# C8 A  |' R* l9 T 
# 重载配置文件,使之马上生效* s5 |2 \8 n( |8 ?* K  U" m 
$ sudo sysctl -p 
- n6 I' t1 d7 j/ f2 l/ B$ i 
: ~5 Y! z, @& ?6 ], e3 i) @$ G 
+ a! v  s8 T! v. b2 D: `+ o |   
 
 
 
 |