说明:
1、RsyncServer服务端
系统:CentOS 6.8
IP地址:192.168.247.141
2、Rsync客户端
系统:Windows10
实现目的:
Rsync客户端同步服务端/data/test下的文件到E/test下
一 、在linux上安装rsync
1、#rpm -qa|grep rsync
yum install rsync -y
2、vim /etc/rsyncd.conf
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | uid=root gid=root max connections=10 log file=/var/log/rsyncd.log pid file=/var/run/rsyncd.pid lock file=/var/run/rsyncd.lock secrets file=/etc/rsyncd.passwd #本机上运行的数据库备份的模块配置 [www] comment=backup file path=/data/test read only = no exclude=test auth users=root secrets file=/etc/rsyncd.passwd | 
3、编辑密码文件(密码可自定义):
| 1 2 | [root@host1 15:11:29/data/test]# cat /etc/rsyncd.passwd  root:123456 | 
4、启动rsync
/usr/bin/rsync –daemon –config=/etc/rsyncd.conf
| 1 2 3 | [root@host1 15:11:25/data/test]# netstat -nlpt | grep 873 tcp        0      0 0.0.0.0:873                 0.0.0.0:*                   LISTEN      46127/rsync          tcp        0      0 :::873                      :::*                        LISTEN      46127/rsync | 
二、windows客户端安装rsync
1、安装cwRsync_4.2.0_Installer
2、打开CMD命令,进入到rsync的执行目录,然后执行命令同步到E盘test文件下
| 1 | C:\Program Files (x86)\cwRsync\bin>rsync.exe -vzrtopgu --progress --delete root@192.168.247.141::www /cygdrive/E/test | 

输入服务端密码文件里的密码,然后回车

可以看出已经有删除和同步文件到E:\test

3、无密码输入同步:
把服务端的/etc/rsyncd.passwd文件下载到客户端指定位置(自己随意指定,我放的是E:\rsyncd.passwd),然后删除前面的”root:”,即只保留密码即可

CMD命令输入:
| 1 | rsync.exe -vzrtopgu --progress --delete root@192.168.247.141::www /cygdrive/E/test --password-file=/cygdrive/E/rsyncd.passwd | 

发表评论
要发表评论,您必须先登录。