zoukankan      html  css  js  c++  java
  • [Linux] 搭建rsync服务端

    rsync是unix/linux下同步文件的一个高效算法,它能同步更新两处计算机的文件与目录,并适当利用查找文件中的不同块以减少数据传输。

    Linux守护进程的运行方式:
    1.独立运行(stand-alone)的守护进程,独立运行的守护进程由init脚本负责管理
    2.xinetd模式运行独立的守护进程

    配置rsync服务端:/etc/rsyncd.conf主配置配件(默认不存在)

    uid = root
    gid = root
    max connections = 4
    read only = true
    hosts allow = *
    transfer logging = true
    log format = %h %o %f %l %b
    log file = /var/log/rsyncd.log
    pid file = /var/run/rsyncd.pid
    lock file = /var/run/rsyncd.lock
    [data0]
    path = /data0       //注意这里的目录
    comment = test
    read only = false
    list = false
    auth users = shihan1 //注意这里的用户名
    secrets file = /etc/rsyncd.pas //用户名密码文件
    

    vim /etc/rsync.pas 配置密码 , 远程rsync服务器的帐户密码文件的权限必须为600

    chmod 600 /etc/rsync.pas

    shihan1:12341234
    

    运行rsync --daemon  

    往主机推数据:  

    rsync -avzP --delete /mnt/public/phpdev/187_test/2018-12-awk-uniq.txt shihan1@服务器ip::data0/

    从主机拉数据:

    rsync -avzP shihan1@服务器ip::data0/* .

  • 相关阅读:
    统计一行字符串中每个字母个数
    不定宽高的文字在div中垂直居中
    转:Python 与 Excel 不得不说的事
    Centos 6安装python3.5
    day04
    day03
    Day02
    python ciscolib模块
    三级菜单
    模拟登陆系统
  • 原文地址:https://www.cnblogs.com/taoshihan/p/10460997.html
Copyright © 2011-2022 走看看