lsyncd配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
settings {
     logfile =  "/var/log/lsyncd.log" , --日志路径
     status =  "/var/log/lsyncd.status" , --状态文件
     pidfile =  "/var/run/lsyncd.pid" , --pid文件路径
     statusInterval = 1,  --状态文件写入最短时间
     maxProcesses = 4,    --最大进程
     maxDelays = 1        --最大延迟
}
--多host同步
servers = {
     "192.168.1.1"
}
-- 多同步目录,源备份用路径和rsync节点名相同
bakpaths = {
     "mysql" ,
     "mongodb" ,
     "mssql"
}
-- 源路径
source_path= '/dbbackup/'
for  _, server in ipairs(servers)  do
     for  _, bakpath in ipairs(bakpaths)  do
     sync {
         default .rsync,
         source = source_path..bakpath,
         target = server.. "::" ..bakpath,
         delete  "running" ,
         exclude = {
         }, 
         rsync = {
             binary =  "/usr/local/bin/rsync" , -- rsync 版本要到3以上
             archive = true,
             compress = true,
             owner = false,
             group = false,
             perms = true,
             verbose = true,
             copy_links = true
         }  
     }  
     end
end