1.lsyncd 安装
yum install -y lua lua-devel lsyncd
2.配置
settings {
nodaemon = false,
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status",
inotifyMode = "CloseWrite",
statusInterval = 20,
maxProcesses = 8,
maxDelays = 10
}
sync {
default.rsync,
delay = 30,
delete="false",
source = "/data/media/video",
target = "rsync@192.168.114.101::tongbu1",
exclude = { ".*", ".tmp","*.bak"},
rsync = {
archive = true,
compress = false,
verbose = false,
-- 配置密码 格式 passwd 权限 chmod 600 /etc/rsync.pas
password_file="/etc/rsync.pas",
_extra = {"--port=16874","--delay-updates"}
}
}
3.开机启动
systemctl enable lsyncd
systemctl start lsyncd
systemctl status lsyncd
4.同步端安安装rsync
yum install -y rsync
配置rsync
vi /etc/rsynd.conf
vi /etc/rsyncd.conf
uid = root
gid = root
use chroot = yes
max connections = 30000
max connections = 0
port = 16874
log file = /tmp/rsyncd.log
motd file = /tmp/rsyncd.motd
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
secrets file = /etc/rsyncd.pswd
auth users = rsync
[tongbu1]
list = false
secrets file = /etc/rsyncd.pswd # 配置用户名密码 格式 username:passwd 权限 chmod 600 /etc/rsyncd.pswd
auth users = rsync
path = /data/media/video
ignore errors = yes
read only = no
开机自启
systemctl enalbe rsyncd
systemctl start rsyncd
systemctl status rsyncd