服务器
A : 10.148.55.33 服务端
B : 10.148.55.219客户端
一 、服务器端配置 --- 10.148.55.33
安装rpm -q rsync
[root@SPD 123]# rpm -qa|grep rsync
修改/etc/xinetd.d/rsync配置文件,將disable=yes更改為disable=no,然後重新啟動服務,service xinetd start.
配置/etc/rsyncd.conf
[root@SPD 123]#vi /etc/rsyncd.conf
####***************************************####
uid=nobody
gid=nobody
max connections = 200
timeout = 600
use chroot = no
read only = yes
pid file = /var/run/rsyncd.pid
host_allow = 10.148.55.219 //客户端的IP地址
#syslog facility = local7
#log file = /var/log/rsyncd.log
#rsync config
#The' standard' things
[rsync_gmmold] //定义同步的路径(关键字为gmmold)
path = /app/temp //需要同步的路径
comment = gmmold
####***************************************####
启动服务
[root@SPD 123]# /usr/bin/rsync --daemon
开机自动启动服务
echo "/usr/bin/rsync --daemon" >> /etc/rc.local
*************************************************************
二、客户端的配置 --- 10.148.55.219
用命令同步
[root@dxczpt temp]#rsync -auqz 148.55.33::rsync_gmmold /app/temp
每半个小时同步一下
crontab -u root -e
0,30 * * * * rsync -auqz 10.148.55.33::rsync_gmmold /app/temp
備注:相關rsync參數設定請參考對應的文檔