简体   繁体   English

lsyncd - 事件队列中的溢出 - 解决方案是调整 fs.inotify.max_queued_events

[英]lsyncd - OVERFLOW in event queue - Solution is to tune fs.inotify.max_queued_events

lsyncd is a fantastic alternative to NFS or NAS for replicating files among your Linux hosts. lsyncd 是 NFS 或 NAS 的绝佳替代品,用于在 Linux 主机之间复制文件。 I have found the daemon works well with large Linux filesystems (many files, small to large sizes, xfs, ext4, luks) but requires some sysctl tuning as your filesystem grows.我发现该守护程序适用于大型 Linux 文件系统(许多文件,从小到大,xfs,ext4,luks),但随着文件系统的增长,需要一些 sysctl 调整。

This "question" is a note to myself so I can always find the answer via searching on stack overflow.这个“问题”是给我自己的一个注释,所以我总是可以通过搜索堆栈溢出来找到答案。 Hope it helps you!希望对你有帮助!

Github Project: https://github.com/axkibe/lsyncd Github 项目: https://github.com/axkibe/lsyncd

Exception in /var/log/lsyncd.log: /var/log/lsyncd.log 中的异常:

Thu Jun 18 17:48:52 2020 Normal: --- OVERFLOW in event queue ---
Thu Jun 18 17:48:52 2020 Normal: --- HUP signal, resetting ---
Thu Jun 18 17:48:52 2020 Normal: waiting for 1 more child processes.

Solution when you see "OVERFLOW in event queue" in lsyncd.log在 lsyncd.log 中看到“事件队列中的溢出”时的解决方案

From other knowledge bases, I had learned to tune max_user_watches , but by also tuning the max_queued_events , I corrected an OVERFLOW in event queue exception.从其他知识库中,我学会了调整max_user_watches ,但通过调整max_queued_events ,我更正了事件队列异常中的 OVERFLOW。

The temporary solution worked without needing to restart my lsyncd process.临时解决方案无需重新启动我的 lsyncd 进程即可工作。

I picked the number 1000000 as an arbitrarily large number.我选择了 1000000 作为一个任意大的数字。 The default Ubuntu 18 value is 16384.默认 Ubuntu 18 值为 16384。

Temporary Solution临时解决方案

Check your current tuning values:检查您当前的调整值:

$ sysctl fs.inotify.max_queued_events
fs.inotify.max_queued_events = 16384
$ sysctl fs.inotify.max_user_watches
fs.inotify.max_user_watches = 8192

Update both max_user_watches and max_queued_events via shell通过 shell 更新 max_user_watches 和 max_queued_events

sudo sysctl fs.inotify.max_user_watches=1000000
sudo sysctl fs.inotify.max_queued_events=1000000

Permanent Solution, Persists after reboot永久解决方案,重启后仍然存在

Update both max_user_watches and max_queued_events in /etc/sysctl.conf更新 /etc/sysctl.conf 中的 max_user_watches 和 max_queued_events

fs.inotify.max_user_watches=1000000
fs.inotify.max_queued_events=1000000

Lsyncd.conf Basic Configuration lsyncd.conf 基本配置

/etc/lsyncd/lsyncd.conf /etc/lsyncd/lsyncd.conf

settings {
    logfile = "/var/log/lsyncd.log",
    pidfile = "/var/run/lsyncd/lsyncd.pid",
    insist = true
}
sync {
   default.rsyncssh,
   source="/var/application/data",
   host="node2",
   excludeFrom="/etc/lsyncd/exclude",
   targetdir="/var/application/data",
   rsync = {
     archive = true,
     compress = false,
     whole_file = true
   },
   ssh = {
     port = 22
   }
}

System Details系统详情

Linux service1staging 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Linux service1staging 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Ubuntu 18.04.4 LTS Ubuntu 18.04.4 LTS

lsyncd --version Version: 2.1.6 lsyncd --version 版本:2.1.6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM