介紹個實用的備份工具 - rsync
可以像scp複製檔案到遠端的主機,
比scp好是它會在同步複製前比對同檔名之檔案,
確認與來源檔相同即跳過,
快速、準確、設定簡易
OS:Fedora 13 *2 (Server & Client)
Requirments:
rsync
xinetd
以下記錄設定過程:
1. 安裝套件 (Server & Client)
yum install rsync xinetd
2. 設定rsync服務 (Server)
vi /etc/xinetd.d/rsync
service rsync
{
disabled = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
3. 啟動服務,確認 (Server)
/etc/init.d/xinetd start ; netstat -tnulp | grep 873
4. 設定組態檔 (Server)
vi /etc/rsyncd.conf
[test備份主機代號(自訂)]
path = /tmp存放檔案的路徑
auth users = testuser授權的帳號
uid = root
gid = root
secrets file = /etc/pass
read only = no
5. 設定密碼檔 (Server)
vi /etc/pass
testuser:testpass (授權的帳號:密碼)
6. 修改密碼檔權限 (Server)
chown root.root /etc/pass
chmod 600 /etc/pass
7. 設定密碼檔 (Client),修改屬性
vi /root/pass
testpass (對應Server的密碼檔)
chmod 600 /root/pass
8. 驗收
/usr/bin/rsync -rvlHpogDtS --password-file=/root/pass /etc(預備份之檔案、目錄) testuser(授權帳號)@Server IP(domain naem)::test(備份主機代號)
參數說明:
-r 連子目錄一起備份
-v 顯示過程
-l 複製symlinks
-H 保留Hard links
-p 保留原始權限
-o 保留擁有者
-g 保留群組
-t 保留修改時間
--password-file client端密碼檔的位置
--delete 刪除Server端多出Client端的檔案
參考文章:
http://www.csie.nctu.edu.tw/~tsaiwn/course/introcs/history/linux/linux.tnc.edu.tw/techdoc/rsync.htm
沒有留言:
張貼留言