我更喜歡使用 rsync 守護程式來滿足我的所有 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 = 1
,while
循環就能夠啟動無限的執行緒並消耗不必要的資源,因此每個模組的連線數受到限制。同時,每個文件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
錯誤?