加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

rsyncd的配置和使用

发布时间:2020-12-14 02:00:31 所属栏目:Linux 来源:网络整理
导读:服务器端配置文件说明 # /etc/rsyncd: configuration file for rsync daemon mode# See rsyncd.conf man page for more options.# configuration example:motd file = /etc/ rsyncd.motd#设置服务器信息提示文件,在该文件中编写提示信息log file = /var/log

服务器端配置文件说明

# /etc/rsyncd: configuration file for rsync daemon mode

# See rsyncd.conf man page for more options.

# configuration example:
motd file = /etc/rsyncd.motd
#设置服务器信息提示文件,在该文件中编写提示信息

log file = /var/log/rsyncd.log
#设置日志文件名,可通过log format参数设置日志格式

pid file = /var/run/rsyncd.pid
#设置rsync进程号保存文件名称

lock file = /var/run/rsync.lock
#设置锁文件名称

port = 873
#设置服务器监听的端口号,默认是873

read only = yes
#是否允许客户端上传数据,yes表示不允许

max connections =10
#设置并发连接数,0表示无限制

# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2

# [ftp]
#        path = /home/ftp
#        comment = ftp export area


[fdsfast]
        #自定义模块名,rsync通过模块定义同步的目录,可定义多个

        comment = fdsfast_data
        #定义注释说明字串

        path = /data
        #同步目录的真是路径通过path指定

        ignore errors
        #忽略一些IO错误

        #exclude = test/    #exclude指定common目录下某个目录可以不同步数据

        auth users = user
        #设置允许连接服务器的账户,此账户可以是系统中不存在的用户

        secrets file = /etc/rsyncd.secrets
        #密码验证文件名,该文件权限要求为只读,建议为600,仅在设置auth users后有效

        hosts allow = 192.168.10.38/255.255.255.0
        #设置哪些主机可以同步数据,多ip和网段之间使用空格分隔

        #hosts allow = 172.16.10.0/255.255.255.0   #设置哪些主机可以同步数据,多ip和网段之间使用空格分隔
        hosts deny = *
        #除了hosts allow定义的主机外,拒绝其他所有

        list = false
        #客户端请求显示模块列表时,本模块名称是否显示,默认为true

?

客户端操作

rsync -vzrtopg --progress [email?protected]::fdsfast/fastdfs backup/fastdfs/  //注意区分模块名和目录名,::fdsfast是模块名

?

?参数说明

v:显示详细信息z:传输过程中对数据进行压缩r:递归t:保留修改时间属性o:保留文件所有者属性p:保留文件权限属性g:保留文件所属组属性a:归档模式,主要保留文件属性,等同于-rlptgoD--progress:显示数据传输的进度信息--password-file=FILE:指定密码文件,将密码写入文件,实现非交互式数据同步,这个文件名也需要修改权限为600--delete:删除那些仅在目标路径中存在的文件(源路径中不存在),在脚本中的数据同步经常加上此参数--list-only:仅列出服务器模块列表,需要rsync服务器设置list=true

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读