zoukankan      html  css  js  c++  java
  • 数据同步 rsync+notify架构

    rsync 同步命令,非常好用

    notify是监控本地文件的变化的

    、安装配置

    1. 安装rsync,inotify-tools

    sudo apt-get install rsync inotify-tools 

    2. 拷贝rsync配置文件

    mkdir /etc/rsync
    cp /usr/share/doc/rsync/examples/rsyncd.conf   /etc/rsync/

    3. 服务端配置/etc/rsync/rsyncd.conf

    #secrets file=/etc/rsync/rsyncd.secrets
    #motd file=/etc/rsync/rsyncd.motd
    [test]
    #path=/usr/share/nginx/html
    path=/usr/share/nginx/html
    
    log file=/var/log/rsyncd.log
    pid file=/var/log/rsyncd.pid
    lock file=/var/run/rsync.lock
    
    read only=no
    list=yes
    uid=root
    gid=root
    use chroot=no
    max connections=5
    comment=share file
    #ignore errors
    上面这种是比较严谨的做法,实际上,如果是局域网内网的话,不需要设置权限,直接更改把标签名改成test,path=/test (你要共享的路径)

    4. 创建同步目录

    mkdir /test

    5. 创建认证文件,修改权限600

    vim /etc/rsync/rsync.secrets
    user:passwd
    chmod 600  /etc/rsync/rsync.secrets

    6. 修改 /etc/default/rsync,设置为true   注意一定要修改这个,不然rsync启动不了

    RSYNC_ENABLE=true
    RSYNC_CONFIG_FILE= "/etc/rsync/rsyncd.conf"

    7. 服务端启动rsync服务

    /etc/init.d/rsync start
     

    8. 然后就可以在客户端使用命令  rsync -a 192.168.1.229::,然后会发现 test 这个标签是可以进行同步的。



  • 相关阅读:
    Java JMX 监管
    Spring Boot REST(一)核心接口
    JSR 规范目录
    【平衡树】宠物收养所 HNOI 2004
    【树型DP】叶子的颜色 OUROJ 1698
    【匈牙利匹配】无题II HDU2236
    【贪心】Communication System POJ 1018
    【贪心】Moving Tables POJ 1083
    Calling Extraterrestrial Intelligence Again POJ 1411
    【贪心】Allowance POJ 3040
  • 原文地址:https://www.cnblogs.com/to-be-rich/p/6678252.html
Copyright © 2011-2022 走看看