debian 安装配置lsyncd
安装lsyncd
:~# apt-get install -y lsyncd
整理需要同步的服务器

整理配置文件
:/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,
}
}启动测试
:/data/lsyncd# lsyncd /etc/lsyncd.conf
测试
目录里面有问题或者新建立都会同步,注意没有目录会自己创建目录同步
相关推荐
菜鸟上路CCLinux 2020-11-04
xiaoemo0 2020-08-09
84931231 2020-07-30
82941732 2020-07-27
wh0 2020-07-27
taianxiaojia 2020-07-15
mattraynor 2020-06-25
82941732 2020-06-11
安得情怀似旧时 2020-06-08
libra0 2020-06-01
84931231 2020-05-06
Summer的小屋 2020-03-26
82941732 2020-03-10
82941732 2020-03-04
咏月东南 2020-02-25
zhongcanw 2020-02-22