lsyncd+rsync (大文件)实时同步

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

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值