首先看下服务器端:192.168.1.9的rsync.conf内容,Client端192.168.1.5
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[byq]
path = /cygdrive/f/a/chenkangle #重要,目录
comment = This ChenKangle Directory #目录注释
read only = false #只读开关
ignore errors #忽略I/O错误
list = no #不允许列出List
hosts allow = 192.168.1.9 #允许主机
hosts deny = 0.0.0.0/0.0.0.0 #拒绝主机
auth users = name #认证用户名
secrets file = /cygdrive/f/a/rsync.passwd #认证密码文件
transfer logging = yes
rsync.passwd文件内容:
name:123
实例一:
rsync -vzrtopg –progress –delete /cygdrive/f/a/ 192.168.1.9::byq
这一条是从本地上载文件到服务器上,也就是从Client上传到RsyncServer端
实例二:
rsync -vzrtopg –progress –delete 192.168.1.9::byq /cygdrive/f/a/
这两刚好相反,是从RsyncServer下载到本地
这里我做测试的时候出了点意外,是自己大意,将/cygfrive/f/a/的f忘加了,系统将我最后一个盘的资料一下子删除几十个G,不过还好是些影碟,没关系,算是这一课的经验吧,呵呵!
实例三:
rsync -vzrtopg –progress –delete /cygdrive/j/byq/soft/ lele@192.168.1.9::byq –password-file=/cygdrive/j/byq/rsync.txt
rsync.txt文件内容:
123
这里对于自动化与智能来说非常重要,–password-file=/cygdrive/j/byq/rsync.txt 这里是运行命令的时候加载密码文件,不需要用户输入密码,系统自己备份。
以上三个实例,这里比较下,实例一是任何人都可以去备份,安全性低
实例二对于一些手动备份比较实用,当需要备份时输入密码就可以了
实例三对于定时与实例备份都比较实用,所以对于网管这条命令比较实用。
rsync 192.168.1.9:: 列出当前可用的List
rsync user@192.168.1.9::
rsync user@192.168.1.9::module
rsync user@192.168.1.9::module/path
如果没有配置rsync server 可以通过 ssh 方式使用
rsync -e ssh -auvPz 192.168.1.9:/etc ./
Powered by MightyAdsense
没有评论
第一个在本文留言。
发表评论
字体为 粗体 是必填项目,邮箱地址 永远不会 公布。
允许部分 HTML 代码:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>URLs(网站链接)必须完整有效 (比如: http://www.23day.com),所有标签都必须完整的关闭。
超出部分系统将会自动分段及换行。
请保证评论内容是与日志或 Blog 内容相关的,灌水、攻击性或不恰当的评论 可能 会被编辑或删除。