检查是否安装软件
[root@test ~]# rpm -qa | grep rsync rsync-3.1.2-10.el7.x86_64
服务器配置
cat /etc/rsyncd.conf uid = root gid = root use chroot = no max connections = 20000 log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock [idn_game_log_rsync] path = /data/game_LOG_rsync/ auth users=rsync read only = no hosts allow = 10.11.0.0/18 hosts deny = * secrets file = /etc/rsyncd.pass ignore errors = yes #game-configs [game-configs] path = /data/game_LOG_rsync/game-conf/ auth users=rsync read only = no hosts allow = 10.11.0.0/18 hosts deny = * secrets file = /etc/rsyncd.pass ignore errors = yes
密码:
cat /etc/rsyncd.pass rsync:[email protected]
启动:
rsync --daemon --config=/etc/rsyncd.conf
验证启动结果:
[root@test /]# ps -ef | grep rsync | grep -v grep root 15096 1 0 2021 ? 00:02:13 rsync --daemon --config=/etc/rsyncd.conf
客户端脚本
cat /data/script/log_rsync_resWeb.sh
#!/bin/sh echo "start [`date +"%Y-%m-%d %H:%M:%S"`]" >> /opt/rsync.log rsync -avz --password-file=/etc/rsyncd.pass --exclude-from=/etc/rsync_dexclude.list /data/game [email protected]::game_log_rsync exit 0
排除不同步的文件类型
cat /etc/rsync_dexclude.list *.sh *.json *.lua *.txt configs conf
客户端密码文件:
cat /etc/rsyncd.pass [email protected]
定时任务:
*/20 * * * * bash /data/script/log_rsync_resWeb.sh
标签:rsync,log,备份,etc,game,file,rsyncd,日志 From: https://www.cnblogs.com/huanglingfa/p/16730113.html