add lsyncd config

This commit is contained in:
Kyle Drake 2015-03-01 15:29:35 -08:00
parent 73adf1f984
commit 6ccabdc5f4
3 changed files with 54 additions and 0 deletions

15
vagrant/fs-primary.sh Normal file
View file

@ -0,0 +1,15 @@
#!/bin/bash
DEBIAN_FRONTEND=noninteractive
apt-get install -y lsyncd
mkdir /etc/lsyncd
# STOP. Generate a root ssh key on primary, and provide the public key to the root account on secondary in authorized_keys.
cp fs-primary/etc/lsyncd/lsyncd.conf.lua /etc/lsyncd/
# EDIT /etc/lsyncd/lsyncd.conf.lua
cp fs-primary/etc/logrotate.d/lsyncd /etc/logrotate.d/
service lsyncd start
#should already exist: sudo update-rc.d lsyncd defaults

View file

@ -0,0 +1,13 @@
/var/log/lsyncd*.log {
monthly
missingok
rotate 7
compress
delaycompress
notifempty
su root root
sharedscripts
postrotate
[ -s /run/lsyncd.pid ] && /usr/sbin/service lsyncd restart > /dev/null 2>/dev/null || true
endscript
}

View file

@ -0,0 +1,26 @@
-- Inotify listener max needs to be turned up. Assume 2KB per directory watched.
-- The number of mirrored directories is the relevant variable because a Linux watch is created for each directory.
-- It may make more sense to use a SITENAME_FILENAME strategy here instead of directory partitioning.
-- The below example is 10 gigabytes / 2 = number of watches for 10GB, which is 5 million directories.
-- echo 5000000 > /proc/sys/fs/inotify/max_user_watches
-- For /etc/sysctl.conf: fs.inotify.max_user_watches=5000000
-- Make sure maxProcesses is below ssh's MaxSessions (default is 10)
settings {
logfile = "/var/log/lsyncd.log",
statusFile = "/var/log/lsyncd-status.log",
maxProcesses = 8
}
sync {
default.rsyncssh,
delete=true,
source="/home/*ACCOUNT*/testone",
host="*HOST*",
targetdir="/home/*ACCOUNT*/testone",
rsync = {
compress = true,
archive = true,
perms = true,
owner = true
},
delay=0
}