首页 > 代码库 > 使用lsyncd配置数据库备份多异地同步

使用lsyncd配置数据库备份多异地同步

 

lsyncd配置文件

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        }       }       endend