• centos7安装rsync及两台机器进行文件同步


    安装及配置

    yum -y install rsync  
    #启动rsync服务
    systemctl start rsyncd.service
    systemctl enable rsyncd.service
    
    #检查是否已经成功启动
    netstat -lnp|grep 873

    服务端配置

    # /etc/rsyncd: configuration file for rsync daemon mode
    
    # See rsyncd.conf man page for more options.
    
    # configuration example:
    
    uid = root
    gid = root
    port = 873
    use chroot = no
    # read only = no
    # list = no
    max connections = 4
    # pid file = /var/run/rsyncd.pid
    exclude = lost+found/
    transfer logging = yes
    timeout = 900
    motd file = /etc/rsyncd/rsyncd.motd
    log file = /var/log/rsyncd.log
    lock file = /var/run/rsyncd.lock
    ignore nonreadable = yes
    dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
    
    [simba]
    path = /root/************/
    comment=simba
    ignore errors
    read only = no
    write only = no
    list = no
    auth users = root
    secrets file = /etc/rsyncd.pass
    hosts allow = *

    给rsync定义身份,如下:

    echo 'root:123456'>/etc/rsyncd.passwd   //文件用户名和路径为上面定义,别写错,密码自己定
    chmod 600 /etc/rsyncd.passwd        //修改权限

    重启服务

    systemctl restart rsyncd.service

    客户端配置

    创建密码

    echo '123456' >>/etc/rsyncd-test.passwd     //注意这里只需要服务器rsyncd.passwd 中的密码
    chmod 600 /etc/rsyncd-test.passwd

    同步

    rsync -auv --password-file=/etc/rsyncd-test.passwd  /root/*********/ root@120.x.x.x::simba
  • 相关阅读:
    feign远程调用问题
    java8--stream
    feign业务组件远程请求 /oauth/token
    redis实现自增序列
    MySQL数据库 相关知识点
    netty
    spring的启动流程及bean的生命周期
    MethodHandleVS反射
    并发与并行
    关于注解的思考
  • 原文地址:https://www.cnblogs.com/wangbaihan/p/10734908.html
Copyright © 2020-2023  润新知