RSYNC实现文件同步


客户端:

安装rsync

yum -y install rsync


设置配置文件

vim /etc/rsyncd.conf

uid = root

gip = root

max connections = 3600

read only = no

log file = /var/log/rsyncd.log

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsyncd.lock


[tbtest]            模块名称,可自定义

path = /chmei        要同步的目录路径

comment = Mirror to tbtest test

gnore errors

read only = no

hosts allow = SERVERIP                服务端IP

hosts deny = 0.0.0.0/32



ulimit -SHn 65535

/usr/bin/rsync --daemon /etc/rsyncd.conf

设置开机启动:

echo "ulimit -SHn 65535" >> /etc/rc.local

echo "/usr/bin/rsync --deamon /etc/rsyncd.conf" >> /etc/rc.local



服务端:

yum -y install rsync

rsync -avzP /chmei/ root@CUSTOMERIP::tbtest

 注:/chmei/ 同步目录

      root 用户名

      CUSTOMERIP 目的服务器ip,即客户端ip,安装并配置完毕rsync

      tbtest 模块自定义名称









cd /usr/local/src

tar xf sersync_64bit_binary_stable_final.tar.gz

mv GNU-Linux-x86 sersync

vim sersync/confxml.xml 

    <sersync>

        <localpath watch="/chmei">

            <remote ip="127.0.0.1" name="tbtest1"/>

            <!--<remote ip="CUSTOMERIP1" name="tbtest"/>-->

            <!--<remote ip="CUSTOMERIP2" name="tbtest"/>-->

        </localpath>

:wq





本文参考链接:http://blog.chinaunix.net/uid-1840233-id-4379852.html

你可能感兴趣的:(rsync,文件同步)