備份主機…
server side ( backup server、mirror server )…
=======================================
安裝 rsync…
apt-get install rsync
設置 rsync…
nano /etc/default/rsync
-------------------------------------------
RSYNC_ENABLE=true
-------------------------------------------
設置 rsync client…
nano /etc/rsyncd.conf
-------------------------------------------
[backup_home]
hosts allow = xxx.xxx.xxx.xxx
hosts deny = *
path = /home
auth users = backup_admin
uid = root
gid = root
secrets file = /etc/rsyncd.secrets
read only = no
[backup_www]
hosts allow = xxx.xxx.xxx.xxx
hosts deny = *
path = /var/www
auth users = backup_admin
uid = root
gid = root
secrets file = /etc/rsyncd.secrets
read only = no
-------------------------------------------
設置密碼…
nano /etc/rsyncd.secrets
-------------------------------------------
backup_admin:password1234
-------------------------------------------
變更權限…
chown root:root /etc/rsyncd.secrets
chmod 600 /etc/rsyncd.secrets
啟動 rsync …
/etc/init.d/rsync start or restart
=======================================
待備份電腦…
client side ( main server、www server )…
=======================================
安裝 rsync…
apt-get install rsync
設置密碼…
nano /etc/rsyncd.passwd
-------------------------------------------
password1234
-------------------------------------------
變更權限
chmod 600 /etc/rsyncd.passwd
chown root:root /etc/rsyncd.passwd
shell 下執行備份(/home/)…
rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /home/ backup_admin@xxx.xxx.xxx.xxx::backup_home
(一行指令)
shell 下執行備份(/var/www/)…
rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /var/www/ backup_admin@xxx.xxx.xxx.xxx::backup_www
(一行指令)
定時啟動備份…
nano /etc/crontab
-------------------------------------------
0 2 * * * root /usr/bin/rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /home/ backup_admin@xxx.xxx.xxx.xxx::backup_home
0 4 * * * root /usr/bin/rsync -arHz --progress --delete --password-file=/etc/rsyncd.passwd /var/www/ backup_admin@xxx.xxx.xxx.xxx::backup_www
-------------------------------------------
(二行設置)
=======================================
參考來源…
http://www.howtoforge.com/mirroring_with_rsync
http://linux.tnc.edu.tw/techdoc/rsync.htm
http://fanqiang.chinaunix.net/a6/b7/20010908/1305001258_b.html
http://moto.debian.org.tw/viewtopic.php?t=6757
http://b2ddoc.tnc.edu.tw/yh/LinuxBase/m6_server_setup.html#mozTocId848674
沒有留言:
張貼留言