zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    js实现将字符串里包含手机号的中间四位替换为****
    草稿for套for
    js实现将时间戳转换成2017-05-06 09:03:02
    时间日期校验接口
    JS延迟导航nav
    nav导航
    鼠标滚动请求加载
    常用开源Jabber(XMPP) IM服务器介绍(转)
    01.base-v1.js
    Haproxy安装及配置(转)
  • 原文地址:https://www.cnblogs.com/wangbaihan/p/10734908.html
Copyright © 2011-2022 走看看