1. Structure description
In order to prevent data loss caused by the failure of enterprise MySQL, this structure is derived
2. Environmental preparation
Two centos7
192.168.59.143 (server that needs backup)
192.168.59.144 (backup storage server)
Three, two install rsync service
yum -y install rsync
4. Modify the rsync configuration file of the server that needs to be backed up (192.168.59.143)
vim /etc/rsyncd.conf
添加如下配置
uid = root
gid = root
use chroot = no
max connections = 2
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[app] #模块
path = /data/ #备份路径
ignore errors
read only = false
list = false
auth users = backup
secrets file = /etc/rsync.passwd
Edit the password file and grant permissions (both of them are required)
echo "rsync_user:rsync_user_pwd" > /etc/rsync.password
chmod -R 600 /etc/rsync.password
Five, start rsync
1. Solve the error and not start
yum -y install xinetd
vim /etc/xinetd.d/rsync
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
systemctl restart xinetd
Six, write a mission plan
crontab -e
Write the following commands into the script
/usr/bin/rsync -vzrtopg --progress --password-file=/etc/rsync.passwd backup@192.168.59.143::app /data/
Seven, write incremental scripts