rsync+innotify端配置文件脚本
src=/data/tfCarFace/DB_slave2=10.171.54.183DB_slave1=10.162.209.36atlas1=10.162.211.200atlas2=10.171.53.150DB_master1=10.162.213.176DB_master2=10.165.65.246user=testds1=DB-slave2ds2=atlas1ds3=atlas2ds4=DB-slave1ds5=DB-master1ds6=DB-master2#passwdfile=/etc/rsyncd.pass /usr/bin/inotifywait -mrq --timefmt '%d%m%y %H:%M' --format '%T %w%f%e' -e create,delete,modify,attrib $src \ | while read files do/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_slave2::$ds1 > /dev/null 2>&1/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$atlas1::$ds2 > /dev/null 2>&1/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$atlas2::$ds3 > /dev/null 2>&1/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_slave1::$ds4 > /dev/null 2>&1/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_master1::$ds5 > /dev/null 2>&1/usr/bin/rsync -vzrtopg --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_master2::$ds6 > /dev/null 2>&1 echo "${files} was rsynced" >>/tmp/rsync.log 2>&1 done
需要同步的客户端配置
uid=rootgid=rootmax connections=10use chroot=nolog file=/var/log/rsyncd.logpid file=/var/run/rsyncd.pidlock file=/var/run/rsyncd.lock[atlas1]path=/data/tfCarFace/comment = TfCarFace backupignore errors = yesread only = noauth users=testsecrets file=/etc/rsyncd.passhosts allow = 10.0.0.0/8hosts deny = *