freebsd rsync 数据镜像备份

前言
rsync是Linux系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。rsync支持大多数的类Unix系统,无论是Linux、Solaris还是BSD上都经过了良好的测试。rsync的最新版本可以从 http://rsync.samba.org/rsync/获得。它的特性如下:
1、可以镜像保存整个目录树和文件系统。
2、可以很容易做到保持原来文件的权限、时间、软硬链接等等。
3、无须特殊权限即可安装。
4、优化的流程,文件传输效率高。
5、可以使用rcp、ssh等方式来传输文件,当然也可以通过直接的socket连接。


本文介绍了如何使用rsync服务从Linux到Windows和linux进行远程备份
软件及平台
FreeBSD 5.2 (Server and Client)
Server IP:192.168.83.80 Hostname: freebsd-1
Client IP:192.168.83.81 Hostname: freebsd-2
apache_1.3.29
rsync-2.5.7
目的/etc/rsyncd.conf

备份Rsync Server(192.168.83.80)上的 /usr/local/apache2/htdocs 目录下所有内容,到Rsync Client(192.168.83.81)的/backup/www 下
安装及配置
一,Rsync Server
Step 1: 安装
freebsd-1#cd /usr/ports/net/rsync
freebsd-1#make install clean .
Step 3: 配置rsyncd.conf
freebsd-1#vi /usr/local/etc/rsyncd.conf //加入以下内容
[www]
comment = web server backup
path = /usr/local/apache2/htdocs
auth users = tonny
uid = nobody
gid = nogroup
secrets file = /usr/local/etc/rsyncd.secrets
read only = no

 cat /etc/rsyncd.conf

查看源代码打印帮助01 strict modes = yes 

02 uid = nobody 

03 gid = nobody 

04 use chroot = no 

05 pid file = /var/run/rsyncd.pid 

06 lock file = /var/run/rsync.lock 

07 log file = /var/log/rsyncd.log 

08 port = 873 

09 [log] 

10 max connections = 0 

11 path = /var/log 

12 uid = root 

13 gid = root 

14 read only = no 

15 hosts allow = 192.168.1.0/24,218.85.157.99 

16 hosts deny = * 

17 ignore errors 

18 secrets file = /etc/rsyncd.passwd 

19 auth users = test

创建密码
# echo “test:test” > /etc/rsyncd.passwd
# chmod 600 /etc/rsyncd.passwd
启动rsync
# /usr/bin/rsync –daemon
2.客户端执行
# /usr/bin/rsync -vzrtopg –delete –progress test@192.168.1.10::log /var/log
rsync –daemon –config=/etc/rsyncd.conf
/usr/local/bin/rsync –daemon –config=/etc/rsyncd.conf
kill -HUP `cat /var/run/rsyncd.pid`
kill -HUP `cat /var/run/xinetd.pid`
/usr/local/etc/rc.d/xinetd

usr/local/bin/rsync -avzP –delete –password-file=/usr/local/etc/rsyncd.secrets tonny@172.18.5.251::www
/backup/www/
strict modes = yes 
uid = nobody 
gid = nobody 
use chroot = no 
pid file = /var/run/rsyncd.pid 
lock file = /var/run/rsync.lock 
log file = /var/log/rsyncd.log 
port = 873 
[cms4] 
max connections = 0 
path = /home/ppabc1/444 
uid = root 
gid = root 
read only = no 
hosts deny = * 
ignore errors 

18 secrets file = /etc/rsyncd.passwd 

19 auth users = test

参考文档
mysql 备份和恢复策略
http://blog.csdn.net/aqwencheng/archive/2010/04/27/5528263.aspx
rsync 错误invalid gid
http://blog.csdn.net/zzz_781111/archive/2009/06/09/4255482.aspx
http://www.xtgly.com/2010/05/28/freebsd-8-0-rsync-%e6%95%b0%e6%8d%ae%e5%90%8c%e6%ad%a5.htm
http://blog.eetag.com/?p=541
http://www.abc188.com/info/html/caozuoxitong/FreeBSD/20090513/126316.html
http://www.bitscn.com/os/Solaris/201010/191673.html
http://os.51cto.com/art/201009/225962.htm
http://os.51cto.com/art/201010/229684.htm
http://www.linuxidc.com/Linux/2010-06/26881.htm
http://www.sudu.cn/info/article/articleInfo.php?aId=7442
http://hi.baidu.com/dotrip/blog/item/333ff9cea88bc91093457e29.html

© 版权声明
THE END
喜欢就支持以下吧
点赞0 分享