Linux服务器双机备份策略

机器:服务器A、备份服务器B
操作系统:Redhat
备份策略:rsync+crontab,定时同步。好处是增量备份,备份包括了文件权限、日期等信息,便于机器之间的快速恢复切换。

Server A:
/etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

[share]
path = /home/filetobackup/
ignore errors
read only = yes
list = yes
auth users = username
secrets file = /etc/password.pas

/etc/password.pas(权限400)
username:password

Server B:
backup.sh
#!/bin/bash
DATE=`date +%w`
/usr/bin/rsync -vzrtopg --progress --delete --password-file=/root/script/password.pas username@ServerA_IP::share /home/backuppath >/root/logs/rsync.$DATE

/root/script/password.pas(权限400)
password

ServerB周一到周五凌晨1点执行脚本定时同步
Crontab:
0 1 * * 2-6 /root/script/backup.sh

你可能感兴趣的:(linux)