》里介绍过使用 lftp 对网站进行增量备份,实际上还有一种高效的方式,即使用 rsync 服务器。在客户端使用 rsync 工具连接安装有 rsync 服务的服务器,可以很方便的对网站进行增量备份,如对论坛一类网站的附件备份尤显得方便。 |
#yum install rsync
#apt-get install rsync
# mkdir /etc/rsyncd
# touch /etc/rsyncd/rsyncd.conf
# touch /etc/rsyncd/rsyncd.secrets
# touch /etc/rsyncd/rsyncd.motd
# cat /etc/rsyncd/rsyncd.motd
-----------------------
welcome to groad.net
-----------------------
# cat /etc/rsyncd/rsyncd.secrets
beyes:123456
# cat /etc/rsyncd/rsyncd.conf
pid file = /var/run/rsyncd.pid
port = 873
address = 192.168.1.102
use chroot = yes
read only = yes
hosts allow=192.168.1.0/255.255.255.0
hosts deny=*
max connections = 5
motd file = /etc/rsyncd/rsyncd.motd
timeout = 600
[wwwroot]
uid = root
gid = root
path = /var/www/html/dz/p_w_uploads
list = yes
ignore errors
auth users = beyes
secrets file = /etc/rsyncd/rsyncd.secrets
comment = www_root_home
pid file = /var/run/rsyncd.pid
port = 873
address = 192.168.1.102
use chroot = yes
read only = yes
hosts allow=192.168.1.0/255.255.255.0
hosts deny=*
max connections = 5
motd file = /etc/rsyncd/rsyncd.motd
timeout = 600
[wwwroot]
path = /var/www/html/dz/p_w_uploads
list = yes
ignore errors
auth users = beyes
secrets file = /etc/rsyncd/rsyncd.secrets
comment = www_root_home
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf
root@bt:~/wwwroot# rsync -avzP beyes@192.168.1.102::wwwroot wwwroot
-----------------------
welcome to groad.net
-----------------------
Password:
receiving incremental file list
./
some.txt
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/7)
sent 81 bytes received 326 bytes 116.29 bytes/sec
total size is 13 speedup is 0.03
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |