inotify是linux下监控文件变化的工具,当系统的文件发生变化时,可以发送通知到应用层。inotify特性在内核版本2.6.13版本已经发布。
inotify的配置参数:
系统默认参数
test01:/# sysctl -a |grep inotify
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536
fs.inotify.max_queued_events = 16384
max_user_instances 每个用户能启动的inotify最大实例数
max_user_watches 每个实例最大的监控数(inode数量)
max_queued_events 队列中最大的事件数,变化频繁的目录下事件会很多,事件先进入队列,当队列满时,会将事件丢弃,同时发出IN_Q_OVERFLOW事件。
Failed to watch .; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via `/proc/sys/fs/inotify/max_user_watches'.
通过修改/etc/sysctl.conf文件,增加配置
fs.inotify.max_user_watches = 6553600