1. Confgiure the Slave Server
Install Rsync on the Slave Server
[root@slave ~]# rpm -ivh rsync-3.1.2-11.el7_9.x86_64.rpm
Configure Rsync on the Slave Server
[root@slave ~]# vim /etc/rsyncd.conf
log file=/var/log/rsync.log pid file=/var/run/rsyncd.pid [server] path=/root/test use chroot=true max connections=4 read only=no list=true uid=root gid=root auth users=root secrets file=/etc/rsync.password hosts allow=X.X.X.X
Create User and Password File for Synchronization
[root@slave ~]# echo "root:123456" >/etc/rsync.password
[root@slave ~]# chmod 600 /etc/rsync.password
Create the Synhcronization Directory
[root@slave ~]# mkdir -p /root/test
Start the Daemon and Add to Startup
[root@slave ~]# rsync --daemon --config=/etc/rsyncd.conf
[root@slave ~]# echo "rsync --daemon --config=/etc/rsyncd.conf" >>/etc/rc.local
[root@slave ~]# chmod +x /etc/rc.d/rc.local
[root@slave ~]# tail -1 /etc/rc.local
[root@slave ~]# reboot
[root@slave ~]# systemctl status rc-local.service
[root@slave ~]# netstat -ntlp | grep rsync
2. Configure the Master Server
Install Rsync on the Master Server
[root@master ~]# rpm -ivh rsync-3.1.2-11.el7_9.x86_64.rpm
Create the Password File on the Master Server
[root@master ~]# echo "123456" >/etc/rsync.password
[root@master ~]# chmod 600 /etc/rsync.password
Deploy sersync
[root@master ~]# mkdir /usr/local/sersync/
[root@master ~]# mkdir /usr/local/sersync/bin
[root@master ~]# mkdir /usr/local/sersync/conf
[root@master ~]# mkdir /usr/local/sersync/logs
[root@master ~]# cd /usr/local/sersync
Copy sersync package sersync2.5.4_64bit_binary_stable_final.tar.gz into this directory.
[root@master sersync]# tar xvf sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@master sersync]# mv GNU-Linux-x86/sersync2 ./bin/sersync
[root@master sersync]# mv GNU-Linux-x86/confxml.xml ./conf/
[root@master conf]# cp confxml.xml confxml.xml.bak
Modify the config.xml File
[root@master sersync]# vim conf/confxml.xml
Add sersync to PATH
[root@master sersync]# echo "export PATH=$PATH:/usr/local/sersync/bin/" >>/etc/profile
[root@master sersync]# source /etc/profile
[root@master sersync]# which sersync
Start sersync
[root@master sersync]# sersync -d -r -o /usr/local/sersync/conf/confxml.xml
Test Synchronization
[root@master sersync]# cd /root/gckj/
[root@master sersync]# mkdir note
[root@slave backup]# ls
Add to Startup and Reboot
[root@master ~]# ln -s /usr/local/sersync/bin/sersync /usr/local/bin/sersync
[root@master ~]# echo "sersync -d -r -o /usr/local/sersync/conf/confxml.xml" >>/etc/rc.local
[root@master ~]# chmod +x /etc/rc.d/rc.local
[root@master ~]# systemctl status rc-local.service
[root@master ~]# tail -1 /etc/rc.local
[root@slave ~]# reboot
Verify Synchronization After Reboot
[root@master sersync]# cd /root/test/
[root@master sersync]# mkdir note
[root@slave backup]# ls