DDR爱好者之家 Design By 杰米
windows做为文件服务器,使用rsync的windows服务版本:cwRsyncServer 下载地址:http://rsync.samba.org

安装过程要设置用于系统服务的帐号和密码,可以默认。
注:此帐号用于启用crsync server服务,需要分配给帐号对要同步文件的相应权限,否则无法操作被同步的文件。

安装完成后修改配置文件 rsyncd.conf, 配置文件内容如下:
复制代码 代码如下:
port = 52326
use chroot = false
strict modes = false
#hosts allow = * #允许所有的访问
hosts allow = 192.168.10.2 #指定特定的IP允许访问
log file = rsyncd.log
lock file = rsyncd.lock
max connections = 10
UID = 0
GID = 0
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = no

[test2]
path = /cygdrive/d/wwwroot/yanghengfei_com
read only = yes
transfer logging = no
auth users = coldstar #同步使用的帐号
secrets file = rsyncd.secrets #密码文件

注:
rsyncd.secrets配置文件的格式为 用户名:密码,如:
coldstar:123456

即添加了一个用户 coldstar,密码为 123456。

Linux服务器上执行同步命令:

rsync -vzrtopg --progress --delete rsync://coldstar@192.168.10.1:52326/test2 /root/test2

然后在password: 提示符下输入密码即可。

也可以把密码写入配置文件引用,如:
rsync -vzrtopg --progress --delete --password-file=/etc/rsync.pass rsync://coldstar@192.168.10.1:52326/test2 /www/users/yanghengfei_com

将以上命令写入计划任务,每1分钟执行,即可实现实时同步的效果。

注:
上面这个命令行中-vzrtopg里的v是verbose,z是压缩,r是recursive,topg都是保持文件原有属性如属主、时间的参数。-- progress是指显示出详细的进度情况,--delete是指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致。

附,rsync使用时的常见问题:

错误1: rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(794) [receiver=3.0.2]
解决:很大可能是服务器端没有开启 rsync 服务。开启服务。 或者开启了防火墙指定的端口无法访问。

错误2:@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1495) [receiver=3.0.2]
解决:服务器端同步目录没有权限,cwrsync默认用户是Svcwrsync。为同步目录添加用户Svcwrsync权限。

错误3:@ERROR: failed to open lock file
rsync error: error starting client-server protocol (code 5) at main.c(1495) [receiver=3.0.2]
解决:服务器端配置文件 rsyncd.conf中添加 lock file = rsyncd.lock 即可解决。

错误4:@ERROR: invalid uid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.2]
解决:在rsyncd.conf文件中添加下面两行即可解决问题
UID = 0
GID = 0

错误5:@ERROR: auth failed on module test2
rsync error: error starting client-server protocol (code 5) at main.c(1296) [receiver=3.0.2]
解决:服务端没有指定正确的secrets file,请在 [test2]配置段添加如下配置行:
auth users = coldstar #同步使用的帐号
secrets file = rsyncd.secrets #密码文件

错误6:password file must not be other-accessible
解决:客户端的pass文件要求权限为600, chmod 600 /etc/rsync.pass 即可。
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。