rsync3.0.6服务端和客户端搭建(前期铺垫)

服务端:(环境:centos5.5 64位)

    1.安装 :

           使用yum -y install rsync

            配置 vi /etc/xinetd.d/rsync  修改disable为no  不禁用

            在/etc下创建rsyncd.conf文件

            uid = root ()
            gid = root
            use chroot = no
            max connections = 7
            pid file = /var/run/rsyncd.pid
            lock file = /var/run/rsync.lock
            log file = /var/log/rsyncd.log


            [backup]  (模块)
            path = /home/xx/   (要同步数据的路径)
            comment = xx.xx.com backup
            ignore errors (忽略错误)
            read only = yes
            list = no
            auth users = rsyncuser  (授权用户)
            secrets file = /home/xxx/rsync.ps
            hosts allow = *(指定不允许连接rsync服务器的机器,可以使用hosts allow的定义方式来进行定义。默认是没有hosts deny定义。
            hosts deny = 0.0.0.0/0    
            transfer logging = yes   (使用log日志)
            log format = "%a %f %l"  (日志文件   %h 远程主机名
                                                                %a 远程IP地址
                                                                %l 文件长度字符数
                                                                %p 该次rsync会话的进程id
                                                                %o 操作类型:"send"或"recv"
                                                                %f 文件名
                                                                %P 模块路径
                                                                %m 模块名
                                                                %t 当前时间
                                                                %u 认证的用户名(匿名时是null)
                                                                %b 实际传输的字节数
                                                                %c 当发送文件时,该字段记录该文件的校验码

        

        创建密码文件:vi /home/xx/rsync.pd           内容:rsyncuser:xxx

        配置rsync自动启动:chkconfig rsync on

                             chkconfig rsync --list (查看)

        启动/etc/init.d/xinetd restart  {start|stop|status|restart|condrestart|reload}

        如果没有xinetd则安装:yum -y install xinetd

        启动server:/usr/bin/rsync --daemon

        查看:ps -ef | grep rsync   (没错就完成)



客户端:

    安装rsync:yum -y install rsync

    创建密码:/home/xx/rsync.pd   内容:xxx

    执行同步命令:rsync -avz --password-file=/home/xx/rsync.pd rsyncuser@xxx.xx.xx.xx(ip)::backup /home/xx/(放入本机地址)

    完成,需要几分钟同步可以放入crontab 执行


    客户端或许会出现的问题:

        

@ERROR : auth failed on module xxx

rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]

原因:

    服务器端该模块(xxx)需要验证用户名密码,但客户端没有提供正确的用户名密码,认证失败。提供正确的用户名密码解决此问题。

 


转载于:https://my.oschina.net/qige/blog/147066

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值