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. Coder-Strike 2014 - Round 1(A~E)

    题目链接 A. Poster time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputou ...

  2. 李洪强iOS开发之【零基础学习iOS开发】【02-C语言】06-变量与内存

    在前面一节中简单介绍了变量的使用,当我们定义一个变量的时候,系统就会为变量分配一块存储空间.而变量的数值在内存中是以二进制的形式存储的,这讲来深入研究变量在内存中的一些存储细节. 一.字节和地址 为了 ...

  3. thinkphp 减少文件目录

    配置 'TMPL_FILE_DEPR'=>'_' 于是模板文件的格式为如:index_index.html,index_show.html .代替原来的目录结构:/index/index.htm ...

  4. ERDAS IMAGINE 9.2安装破解方法

    Install the application. Copy the license.dat and ERDAS.exe to C:\Program Files\Leica Geosystems\Sha ...

  5. PHP 的面向方面编程

    面向方面编程(AOP)对于PHP来说是一个新的概念.现在PHP对于 AOP 并没有官方支持,但有很多扩展和库实现了这个特性.本课中,我们将使用 Go! PHP library 来学习 PHP 如何进行 ...

  6. php.ini – 配置文件详解

    详见: https://my.oschina.net/miaowang/blog/299546 这个文件必须命名为''php.ini''并放置在httpd.conf中的PHPIniDir指令指定的目录 ...

  7. OneNote快捷键

    转载自:http://onenoter.com/2013/04/5792 记录笔记和设置笔记格式 键入和编辑笔记 若要执行此操作 按 打开一个新的 OneNote 窗口. Ctrl+M 打开一个小的 ...

  8. 宏HASH_DELETE

    HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage); NAME 可理解为 void* next /********** ...

  9. 普通方式 分页【NOT IN】和【>】效率大PK 千万级别数据测试结果

    首现创建一张表,然后插入1000+万条数据,接下来进行测试. use TTgoif exists (select * from sysobjects where name='Tonge')drop t ...

  10. [2015编程之美] 第一场C

    题目3 : 质数相关 时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 两个数a和 b (a<b)被称为质数相关,是指a × p = b,这里p是一个质数.一个集合S被 ...