Linux伺服器雙機備份策略

來源:互聯網
上載者:User

機器:伺服器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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.