服务端安装
yum install -y rsync
#创建同步文件的目录
mkdir rsync
#认证密码文件
vim /etc/rsync.passwd
123456
chmod 600 /etc/rsync.passwd
连接测试rsync是否成功
rsync -avzP /rsync/ liuyang@192.168.1.171::sersync/ --password-file=/etc/rsync.passwd
wget --no-check-certificate https://raw.githubusercontent.com/orangle/sersync/master/release/sersync2.5.4_64bit_binary_stable_final.tar.gz
tar zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz
mv GNU-Linux-x86 /opt/sersync
cd /opt/sersync
mkdir conf bin logs
mv confxml.xml conf
mv sersync2 bin/sersync
编辑配置文件
vim /opt/sersync/conf/confxml.xml
<localpath watch="/rsync">
<remote ip="192.168.1.171" name="sersync"/>
</localpath>
<rsync>
<commonParams params="-aruz"/>
<auth start="true" users="liuyang" passwordfile="/etc/rsync.passwd"/>
<userDefinedPort start="false" port="874"/><!-- port=874 -->
<timeout start="true" time="100"/><!-- timeout=100 -->
<ssh start="false"/>
</rsync>
<failLog path="/opt/sersync/logs/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once-->
启动sersync
/opt/sersync/bin/sersync -r -d -o /opt/sersync/conf/confxml.xml
客户端安装
yum install -y rsync
创建同步文件的目录
mkdir rsync
编辑rsync配置文件
vim /etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 2000
timeout = 600
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 192.168.1.0/24
hosts deny = 0.0.0.0/32
auth users = liuyang
secrets file = /etc/rsync.passwd
[sersync]
path = /rsync/
认证密码文件
vim /etc/rsync.passwd
liuyang:123456
chmod 600 /etc/rsync.passwd
/usr/bin/rsync --daemon