1. 创建免密登陆。
1.1 主服务器执行:ssh-keygen
1.2 将生成的/root/.ssh/id_rsa.pub 内容拷贝到从服务武器/root/.ssh/authorized_keys中
2. 主服务器安装lsync
apt install lsyncd
3. 配置lsync vim编辑/etc/lsyncd/lsyncd.conf.luasettings
sync {
default.rsyncssh,
source = "/home/ubuntu/www/client_img",
host = "xltx81602.com",
targetdir = "/home/ubuntu/www/client_img",
-- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst",
-- -- maxDelays = 5,
delay = 0,
-- init = false,
rsync = {
binary = "/usr/bin/rsync",
archive = true,
compress = true,
verbose = true,
_extra = {"--bwlimit=2000"},
},
ssh = {
port = 22
}
}