[root@node04 ~]# yum install -y xinetd rsync
[root@node04 ~]# vim /etc/xinetd.d/rsync
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
[root@node04 ~]# vim /etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 1000
transfer logging = true
log format = "%o %h [%a] %m (%u) %f %l"
log file = /var/log/rsyncd.log
secrets file = /etc/rsyncd.pwd
fake super = yes
[mysql]
path = /home/mysql/backup
auth users = mysql
uid = mysql
gid = mysql
read only = no
[root@node04 ~]# vim /etc/rsyncd.pwd
mysql:abcd.1234
[root@node04 ~]# chmod 600 /etc/rsyncd.pwd
[root@node04 ~]# systemctl start xinetd.service
[root@node04 ~]# systemctl status xinetd.service
[root@node04 ~]# netstat -tunlp | grep 873
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 22082/xinetd
[root@node01 ~]# yum install -y lua lua-devel lsyncd rsync
[root@node01 ~]# vim /etc/lsyncd.conf
settings {
logfile ="/var/log/lsyncd/lsyncd.log",
statusFile ="/var/log/lsyncd/lsyncd.status",
inotifyMode = "CloseWrite",
maxProcesses = 8,
-- nodaemon =true,
}
sync {
default.rsync,
source = "/home/mysql/backup",
target = "mysql@192.168.40.104::mysql",
-- delete = "false", ##源端删除,目标端保留
-- exclude = { '*.log','*.tmp'}, ##排除指定扩展名的文件
-- exclude = {'log/**','tmp/**'}, ##排除目录中的全部文件
-- excludeFrom = "/etc/rsyncd.d/rsync_exclude.lst",
rsync = {
binary = "/usr/bin/rsync",
archive = true,
compress = true,
verbose = true,
password_file = "/etc/client.pwd"
}
}
[root@node01 ~]# vim /etc/client.pwd
abcd.1234
[root@node01 ~]# chmod 600 /etc/client.pwd
[root@node01 ~]# systemctl start lsyncd.service
[root@node01 ~]# systemctl status lsyncd.service