rsync 同步数据

1,主机接收数据

uid = root       
gid = root

use chroot = yes
max connections = 10
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log

[tuijian]
path = /data/static/tuijian
ignore erros
read only = false
list = false
hosts allow = 192.168.0.0/24
hosts deny = 0.0.0.0/32
auth users = rsync
secrets file = /etc/rsyncd.pwd

这里需要注意 uid和gid对 path 要有读写权限才行, 把/usr/bin/rsync --daemon 添加到开机启动 


2,客户机发送发送数据

rsync -vrtL --progress /data/static/tuijian/* [email protected]::tuijian --password-file=/root/rsync.pwd
rsync -vrtL --progress /data/static/tuijian/* [email protected]::tuijian --password-file=/root/rsync.pwd


客户机添加定时任务 */10 * * * * /root/rsync.sh 即可

你可能感兴趣的:(rsync 同步数据)