rsync是linux系统下的数据镜像备份工具。使用快速增量备份工具Remote Sync可以远程同步,支持本地复制,或者与其他SSH、rsync主机同步。
sersync是基于inotify开发的,类似于inotify-tools的工具,Sersync可以记录下被监听目录中发生变化的(包括增加、删除、修改)具体某一个文件或者某一个目录的名字,然后使用rsync同步的时候,只同步发生变化的文件或者目录,因此效率更高。
实验目标:把Linux系统的数据同步到windows中
首先在windows中安装cwRsyncServer_4.1.0_Installer,并进行配置
windows系统下安装:
配置:
在ICW目录下添加home目录
修改配置文件(简单的)c:\ICW\rsyncd.conf
use chroot = false
strict modes = false
hosts allow = *
uid = 0
gid = 0
log file = rsyncd.log
[test]
path = /cygdrive/c/ICW/home#Windows下的路径必须加上/cygdrive/后跟分区及目录
ignore errors
read only = false
transfer logging = yes
auth users = test01
secrets file = /cygdrive/c/ICW/etc/rsyncd.password
在ICW的etc目录下创建密码文件,把用户名和密码填入,格式:用户名:密码
启动:
运行中输入services.msc-启动rsysnc服务服务名称:RsyncServer
在Linux系统安装配置rsync:
安装:yum install –y rsync
rsync配置:
# cat /etc/rsyncd.conf
uid =0 # 虚拟用户egon对应的就是该用户的权限,限制的是客户端的权限
gid =0 # 虚拟用户egon对应的就是该组的权限,限制的是客户端的权限,
use chroot = no
[test]
secrets file = /etc/rsync.passwd
auth users=vendetta
hosts allow =10.41.1.184/32
path=/tmp/1
list=yes
read only =no
ignore errors
创建密码文件:/etc/rsync.passwd,输入windows上配置的用户密码
同步测试:
把/tmp/1目录中的所有数据同步到window中
rsync -avzP /tmp/1 --password-file=/etc/rsyncd.passwd test01@10.41.1.184::test
在Linux系统安装配置Sersync:
安装:
下载:wget https://raw.githubusercontent.com/wsgzao/sersync/master/sersync2.5.4_64bit_binary_stable_final.tar.gz
二进制安装
tar –xzvf sersync2.5.4_64bit_binary_stable_final.tar.gz
mv GNU-Linux-x86 /usr/local/sersync/
ln –s /usr/local/sersync/sersync2 /usr/local/sersync/sersync
修改配置文件:
……
<inotify>
<delete start="true"/>
<createFolder start="true"/>
<createFile start="false"/>
<closeWrite start="true"/>
<moveFrom start="true"/>
<moveTo start="true"/>
<attrib start="true"/>
<modify start="true"/>
</inotify>
<sersync>
<localpath watch="/tmp/1">
<remote ip="10.41.1.184" name="test"/>
</localpath>
<rsync>
<commonParams params="-artuz"/>
<auth start="true" users="test01" passwordfile="/etc/rsyncd.passwd"/>
………
<ssh start="false"/>
</rsync>
……..
</sersync>
运行:
sersync -dro /usr/local/sersync/test02.xml
本文暂时没有评论,来添加一个吧(●'◡'●)