centos7.0安装rsync3.0.9-17.el7
yum install rsync
============================================================================================
Package Arch Version Repository Size
============================================================================================
Updating:
rsync x86_64 3.0.9-17.el7 base 360 k
Transaction Summary
Upgrade 1 Package
Total download size: 360 k
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
rsync-3.0.9-17.el7.x86_64.rpm | 360 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : rsync-3.0.9-17.el7.x86_64 1/2
Cleanup : rsync-3.0.9-15.el7.x86_64 2/2
Verifying : rsync-3.0.9-17.el7.x86_64 1/2
Verifying : rsync-3.0.9-15.el7.x86_64 2/2
Updated:
rsync.x86_64 0:3.0.9-17.el7
Complete!
查看安装地址:
[root@testzabbix ~]# rpm -ql rsync-3.0.9-17.el7.x86_64
/etc/rsyncd.conf
/etc/sysconfig/rsyncd
/usr/bin/rsync
/usr/lib/systemd/system/rsyncd.service
/usr/lib/systemd/system/rsyncd.socket
/usr/lib/systemd/system/rsyncd@.service
/usr/share/doc/rsync-3.0.9
/usr/share/doc/rsync-3.0.9/COPYING
/usr/share/doc/rsync-3.0.9/NEWS
/usr/share/doc/rsync-3.0.9/OLDNEWS
/usr/share/doc/rsync-3.0.9/README
/usr/share/doc/rsync-3.0.9/support
/usr/share/doc/rsync-3.0.9/support/Makefile
/usr/share/doc/rsync-3.0.9/support/atomic-rsync
/usr/share/doc/rsync-3.0.9/support/cvs2includes
/usr/share/doc/rsync-3.0.9/support/deny-rsync
/usr/share/doc/rsync-3.0.9/support/file-attr-restore
/usr/share/doc/rsync-3.0.9/support/files-to-excludes
/usr/share/doc/rsync-3.0.9/support/git-set-file-times
/usr/share/doc/rsync-3.0.9/support/logfilter
/usr/share/doc/rsync-3.0.9/support/lsh
/usr/share/doc/rsync-3.0.9/support/mnt-excl
/usr/share/doc/rsync-3.0.9/support/munge-symlinks
/usr/share/doc/rsync-3.0.9/support/rrsync
/usr/share/doc/rsync-3.0.9/support/rsyncstats
/usr/share/doc/rsync-3.0.9/support/savetransfer.c
/usr/share/doc/rsync-3.0.9/tech_report.tex
/usr/share/man/man1/rsync.1.gz
/usr/share/man/man5/rsyncd.conf.5.gz
[root@testzabbix ~]# which rsync
/usr/bin/rsync
编辑配置文件:服务器端
[root@testzabbix 22]# more /etc/rsyncd.conf
/etc/rsyncd: configuration file for rsync daemon mode
See rsyncd.conf man page for more options.
configuration example:
uid = root
gid = root
use chroot = no
read only = no
hosts allow=10.2.0.0/255.255.255.0
hosts deny=*
max connections = 5
pid file = /var/run/rsyncd.pid
secrets file = /etc/rsyncd.passwd
log file = /var/log/rsync.log
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
MOUDULE OPTIONS
[www]
path = /www/
list=yes
port = 873
ignore errors
auth users = rsync
exclude = lost+found/
transfer logging = yes
ignore nonreadable = yes
dont compress = .gz .tgz .zip .z .Z .rpm .deb .bz2
[ftp]
path = /home/ftp
comment = ftp export area
修改客户端配置文件
/etc/rsyncd.passwd
rsync
启动
service rsyncd start
[root@testzabbix www]# ps aux | grep rsync
root 53161 0.0 0.2 114644 1160 ? Ss 11:13 0:00 /usr/bin/rsync --daemon --no-detach
root 53164 0.0 0.1 112644 984 pts/0 R+ 11:13 0:00 grep --color=auto rsync
客户端执行同步命令:
先执行的是:
C:\cwRsync>rsync --port=873 -vzrtopg --progress --delete rsync@10.2.0.75::www /cygdrive/e/www
结果windows上的文件被服务器同步没了。
查了一下命令:修改为:
C:\cwRsync>rsync --port=873 -vzrtopg --progress --delete /cygdrive/e/www rsync@10.2.0.75::www
可以同步了。
E:>c:\cwRsync\rsync -vzrtopg --port=873 --progress --delete --password-file=rsy
ncd.passwd /cygdrive/e/www rsync@10.2.0.75::www
sending incremental file list
加载密码文件时,总出现auth failed,后来按
三、在cwRsync客户端的任务计划中添加批处理脚本文件,每天凌晨3:00钟自动同步Rsync服务端/data/osyunwei目录中的数据到D:\osyunwei目录
1、打开C:\Program Files\cwRsync\bin目录新建passwd.txt
输入123456
保存
继续在C:\Program Files\cwRsync\bin目录新建osyunwei.bat
输入
@echo off
echo.
echo 开始同步数据,请稍等...
echo.
cd C:\Program Files\cwRsync\bin
rsync -vzrtopg --port=873 --progress --delete osyunweibakuser@192.168.21.160::osyunwei /cygdrive/d/osyunwei < passwd.txt
echo.
echo 数据同步完成
echo.
最后保存退出
2、添加批处理脚本到Windows任务计划
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
开始-设置-控制面板-任务计划
打开添加任务计划,下一步
浏览,选择打开C:\Program Files\cwRsync\bin目录里面的osyunwei.bat
执行这个任务,选择每天,下一步
起始时间:3:00
运行这个任务:每天,下一步
输入Windows系统管理员的登录密码,下一步
完成
扩展说明:如果要调整同步的时间,打开任务计划里面的osyunwei
切换到日程安排来选项设置,还可以打开高级来设置每隔几分钟运行一次osyunwei.bat这个脚本
至此,CentOS Rsync服务端与Windows cwRsync客户端实现数据同步完成
rsyncd.confrsyncd.passwd