root@mysql-2:~# apt-get install -y lsyncd
root@mysql-2:/data/lsyncd# cat /etc/lsyncd.conf
settings {
logfile ="/data/mysql/project_nginx.log",
statusFile ="/data/lsyncd/lsyncd.status",
inotifyMode = "CloseWrite",
maxProcesses = 8,
-- maxConnections = 4,
-- delay = 10,
-- excludeFrom = file,
-- excludeFrom 排除选项
}
sync {
default.rsyncssh,
source = "/data/docker-compose",
host = "192.168.1.23",
targetdir = "/data/docker-compose",
-- exclude = "/data/www/public_html/config.inc.php", #排除此文件不同步
-- maxDelays = 5,累计到多少所监控的事件激活一次同步,即使后面的delay延迟时间还未到
-- delay = 2,
-- init = false,这是一个优化选项,当init = false,只同步进程启动以后发生改动事件的文件,原有的目录即使有差异也不会同步。默认是true
rsync = {
binary = "/usr/bin/rsync",
archive = true,
compress = true,
verbose = true,
-- _extra = {"--bwlimit=2000"},
},
ssh = {
binary = "/usr/bin/ssh",
port = 22,
}
}
sync {
default.rsyncssh,
source = "/data/docker-compose", #源目录
host = "192.168.1.43",
targetdir = "/data/docker-compose", #目标目录
-- exclude = "/data/www/public_html/config.inc.php",
-- maxDelays = 5,累计到多少所监控的事件激活一次同步,即使后面的delay延迟时间还未到
-- delay = 2,
-- init = false,这是一个优化选项,当init = false,只同步进程启动以后发生改动事件的文件,原有的目录即使有差异也不会同步。默认是true
rsync = {
binary = "/usr/bin/rsync",
archive = true,
compress = true,
verbose = true,
-- _extra = {"--bwlimit=2000"},
},
ssh = {
binary = "/usr/bin/ssh",
port = 22,
}
}
root@mysql-2:/data/lsyncd# lsyncd /etc/lsyncd.conf
目录里面有问题或者新建立都会同步,注意没有目录会自己创建目录同步
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。