Server setup

0)yum -y install xinetd

vi /etc/xinetd.d/rsync

and ensure following:
    
    disable = no
    
    1)vi /etc/rsyncd.conf
    --------------
    
    uid = nobody
    gid = nobody
    use chroot = no
    max connections = 50
    port = 873
    address = 0.0.0.0
    log file = /var/log/rsyncd.log
    pid file = /var/run/rsyncd.pid
    #hosts allow = 1.2.3.123/32
    
    [main]
    path = /data/upload
    comment = main server data dir
    read only = yes
    dont compress = *.gz *.tgz *.zip *.z *.bz2 *.tbz
    auth users = imguser
    secrets file = /etc/rsyncd.users
    
    *************************
    
    2)
    echo 'imguser:1234' >> /etc/rsyncd.users
    chmod 600 /etc/rsyncd.users

#important!can't use 777 or 700,otherwise will happen---auth failed on module
    
    3)
    yum -y install xinetd
    chkconfig  xinetd on
    chkconfig  sshd on
    
    service xinetd restart
    service sshd restart
    netstat -ano|grep :873
    
    4)
    setsebool -P rsync_disable_trans on

*************

Client comand examples

command example 1:

rsync -avz imguser@10.68.229.204::main /data/upload/ --password-file=/etc/rsyncd.users

在客户端设置密码:#客户端的密码文件格式:password(只有密码,而没有用户名,因为用户名是在命令行指定的,而不能通过密码文件

echo '1234' >> /etc/rsyncd.users

chmod 600 /etc/rsyncd.users 

rsync -avz --delete coupon@10.68.229.204::main /data/upload/--password-file=/etc/rsyncd.users

***crontjob script**********
vi /data/run.rsync.cms

#!/bin/bash
if [ `netstat -anp | grep rsync | wc -l` -gt 0
 ] ; then
echo "Prev rsync still running. Skip now. `date`" >> /var/log/rsyncd-messages.log
exit 1
else
RDIR='main/'
LDIR='/data/upload/'
RADD='10.68.229.204'
BAKUSER='imguser'
PROG='/usr/bin/rsync'
OPTIONS='-arHvz --checksum'
export RSYNC_PASSWORD='1234'
$PROG $OPTIONS $BAKUSER@$RADD::$RDIR $LDIR
fi

6) crontab -e

#sync every 5 seconds.
*/1 * * * * sleep 5 && /data/run.rsync.cms

refer: http://m.oschina.net/blog/91042

rsync 的安装的更多相关文章

  1. windows下rsync部署安装

    windows下rsync部署安装 2012-06-05 12:06:13|  分类: 系统 |  标签:rsync  windows   |字号 订阅   rsync在windows与windows ...

  2. Windows server上rsync的安装和使用

    获取和安装 首先从rsync官网下载软件的安装版本,注意这里要下的是客户端版本,而非服务端版本. 下载完成之后,双击"cwRsync_4.0.5_Installer.exe"图标, ...

  3. rsync服务安装

    1.  rsync是开源的项目,首先去官网上下载安装包.下载地址 http://rsync.samba.org/ftp/rsync/src/ 这边我下载的是3.1.0.tar.gz 解压到/opt/r ...

  4. rsync配置安装

    rsync安装 1.将rsync包解压,包链接: https://pan.baidu.com/s/1jHPosXC 密码: maay 2.进入rsync安装包运行命令: ./configure --p ...

  5. rsync+inotify安装配置 实时同步文件

    安装 #安装inotify 工具 [root@localhost ~]# yum install inotify-tools -y 常用命令 [root@localhost ~]# inotifywa ...

  6. Linux系统下 Rsync 环境安装搭建

    一.Rsync简介 1.认识 Rsync(remote synchronize)是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件.Rsync使用所谓的“Rsync算法”来使本地和远 ...

  7. python自动化运维-编写rsync+sersync安装脚本实现文件实时同步

    rsync+sersync组合可以实时监听目录的变化,实现实时同步数据. 具体安装教程可查看:http://www.osyunwei.com/archives/7447.html. 安装着实有些复杂, ...

  8. Linux下rsync的安装及简单使用

    2018-09-25 15:39:04 一.RSYNC安装环境: centos6.5 iptables关闭和selinux为disabled 源码安装:到rsync官网下载rsync源码安装包,上传到 ...

  9. rsync服务安装使用

    ssh方式与daemon方式有什么大的区别吗?相对来说ssh比较简单易理解,是不是daemon安全性比较高呢? 区别是:ssh方式是通过ssh协议来传输,需要知道对方机器的用户名和密码. daemon ...

随机推荐

  1. Eclipse 插件开发 —— 深入理解查找(Search)功能及其扩展点

    引言 查找功能是计算机语言开发环境 / 平台的一个非常重要的特性.Eclipse 也不例外,它提供了丰富的查找功能(用户可以输入正则表达式或任意字符串,指定查找范围和匹配选项等等),并且提供了简单易用 ...

  2. 漫话C++0x(五)—- thread, mutex, condition_variable

    熟悉C++98的朋友,应该都知道,在C++98中没有thread, mutex, condition_variable这些与concurrency相关的特性支持,如果需要写多线程相关程序,都要借助于不 ...

  3. HDU1412

    大水题.. 求集合的并 /* */ #include<algorithm> #include<iostream> #include<string.h> #inclu ...

  4. Cobalt Strike

    http://www.77169.com/hack/201512/222080.shtm

  5. ripple

     ripple模拟器非常好用,chrome上的插件 

  6. Vim的撤销与重做

    命令模式下 u:撤销 Ctrl+r:重做(撤销撤销)

  7. 【HDOJ】4305 Lightning

    1. 题目描述当一个结点lightning后,可以向其周围距离小于等于R的结点传播lightning.然后以该结点为中心继续传播.以此类推,问最终形成的树形结构有多少个. 2. 基本思路生成树级数模板 ...

  8. 【HDOJ】4374 One hundred layer

    线性DP,使用单调队列优化. /* 4374 */ #include <iostream> #include <sstream> #include <string> ...

  9. Android开发之通过Intent启动系统应用的协议

    使用隐式Intent启动系统应用,除了http协议,还有geo(显示地理位置),tel(拨打电话),file(文件)等

  10. git log

    http://git-scm.com/book/zh/v2 https://backlogtool.com/git-guide/tw/contents/     http://gitbook.liuh ...