Rsync-Daemon 最大连接数错误

Rsync-Daemon 最大连接数错误

我更喜欢使用 rsync 守护进程来满足我的所有 rync 需求,因为它提供了干净的集中管理并节省了系统资源。因此,我的 rync/etc/rsyncd.conf包含多个模块条目。

我实际的 rsync 命令的包装脚本都是循环while,在连接断开的情况下,它们会立即/重复地重新连接到相应的 rsync 守护进程。

问题:
max connections = 1正在读取每个模块的变量 条目全球而不是单独地每个模块。从而导致@ERROR: max connections (1) reached -- try again later发生(无论哪个 rsync-daemon 先连接,都会错误地获取单个可用全球的 max connection = 1,导致所有其他连接失败..很烦人)。

如果没有max connections = 1while循环就能够启动无限线程并消耗不必要的资源,因此每个模块的连接数会受到限制。同时,根据文档,max connections = 1有附带的file.lock。per module

这是我的/etc/rsyncd.conf

[home]
path = /home/username
list = yes
use chroot = false
strict modes = false
uid = root
gid = root
read only = yes
# Data source information
max connections = 1
lock file = /var/run/rsyncd-home.lock

[prod-bkup]
path = /media/username/external/Server-Backups/Prod/today
list = yes
use chroot = false
strict modes = false
uid = root
gid = root
# Don't allow to modify the source files
read only = yes
max connections = 1
lock file = /var/run/rsyncd-prod-bkup.lock

[test-bkup]
path = /media/username/external/Server-Backups/Test/today
list = yes
use chroot = false
strict modes = false
uid = root
gid = root
# Don't allow to modify the source files
read only = yes
max connections = 1
lock file = /var/run/rsyncd-test-bkup.lock

[VminRoot2]
path = /root/VDI-Files
list = yes
use chroot = false
strict modes = false
uid = root
gid = root
# Don't allow to modify the source files
read only = yes
max connections = 1
lock file = /var/run/rsyncd-VminRoot2.lock

这是我的一个 rsync-daemon 包装器脚本的示例:

#!/bin/sh
#
#
while [ 1 ]
do

   cputool --load-limit 7.5 -- nice -n -15 rsync -avxP --no-i-r --rsync-path="rsync" --log-file=/var/log/rsync-home.log --exclude 'snap'  --exclude 'lost+found' --exclude=".*" --exclude=".*/" 127.0.0.1::home /media/username/external/home-files-only && sync && echo 3 > /proc/sys/vm/drop_caches
   
    if [ "$?" = "0" ] ; then
        echo "rsync completed normally"
        exit
    else
        echo "Rsync failure. Backing off and retrying..."
        sleep 10
    fi
done

#end of shell script

问题
我怎样才能消除这个ERROR: max connections (1) reached -- try again later错误?

相关内容