10/22/13

使用lsyncd同步代码和缓存文件目录

1、安装lsyncd

2、配置/etc/lsyncd.conf

settings = {
delay = 1,
maxProcesses = 5,
statusFile = “/tmp/lsyncd.status”,
logfile = “/var/log/lsyncd.log”,
}

targetlist = {
“192.168.0.144:/opt/phpdba/www/html/xxx/”
}

targetlist_cache = {
“192.168.0.122:/tmp/cache/caches/”,
“192.168.0.124:/tmp/cache/caches/”,
“192.168.0.114:/tmp/cache/caches/”,
“192.168.0.113:/tmp/cache/caches/”
}

for _, server in ipairs(targetlist) do
sync{ default.rsync,
source=”/opt/phpdba/www/html/xxx/”,
rsyncOpts={“-rltvupgo”,”-e ssh -p 29622″,”–bwlimit=256″,”–exclude=config.inc.php”},
target=server
}
end

for _, server in ipairs(targetlist_cache) do
sync{ default.rsync,
source=”/opt/phpdba/www/html/ads/adscache/caches/”,
rsyncOpts={“-rltvupgo”,”-e ssh -p 29622″,”–bwlimit=256″},
target=server
}
end

3、/usr/local/bin/lsyncd /etc/lsyncd.conf 启动

09/24/13

lsyncd配置文件

settings = {
delay        = 1,
maxProcesses = 5,
statusFile   = “/tmp/lsyncd.status”,
logfile      = “/var/log/lsyncd.log”,
}

targetlist= {
“127.0.0.1:/dev/shm/ads_tc_cache/adscache/caches/”
}

for _, server in ipairs(targetlist) do
sync{ default.rsync,
source=”/opt/xxx/www/html/ads/”,
rsyncOpts={“-rltvupgo”,”-e ssh -p 29622″,”–bwlimit=256″,”–exclude=config.inc.php”},
target=server
}
end