[ 永远的UNIX::UNIX技术资料的宝库 ]

首页 > 应用专题 > Rsync > 正文

rsync 镜像备份

作者:碧轩 huihoo.com (2005-04-12 16:59:19)

配置 rsync 系统环境

引用
[root@linuxas3 root]# uname -a
Linux linuxas3.9812.net 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux



安装rsync

在AS3 第二张CD上找到rsync-2.5.6-20.i386.rpm

引用
[root@linuxas3 root]# cd /mnt
[root@linuxas3 mnt]# mount cdrom
[root@linuxas3 mnt]# cd cdrom/RedHat/RPMS
[root@linuxas3 RPMS]# rpm -ivh rsync-2.5.6-20.i386.rpm



配置/etc/rsyncd.conf

在rh9,as3系统上rsync安装后,并没有创建rsyncd.conf文档,笔者是自己创建的rsyncd.conf文档

引用
[root@linuxas3 root]# vi /etc/rsyncd.conf

uid=nobody
gid=nobody
max connections=4
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
#auth users=root
secrets file=/etc/rsyncd.pwd

[postfix]
path=/var/mail
comment = backup mail
ignore errors
read only = yes
list = no
auth users = postfix

[netkiller]
path=/home/netkiller/web
comment = backup 9812.net
ignore errors
read only = yes
list = no
auth users = netkiller

[pgsqldb]
path=/var/lib/pgsql
comment = backup postgresql database
ignore errors
read only = yes
list = no



选择说明

引用
uid = nobody
gid = nobody
use chroot = no        # 不使用chroot
max connections = 4    # 最大连接数为4
pid file = /var/run/rsyncd.pid    #进程ID文件
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log    # 日志记录文件
secrets file = /etc/rsyncd.pwd    # 认证文件名,主要保存用户密码,权限建议设为600,所有者root

[module]            # 这里是认证的模块名,在client端需要指定
path = /var/mail    # 需要做镜像的目录
comment = backup xxxx # 注释
ignore errors        # 可以忽略一些无关的IO错误
read only = yes      # 只读
list = no            # 不允许列文件
auth users = postfix  # 认证的用户名,如果没有这行,则表明是匿名

[other]
path = /path/to...
comment = xxxxx


密码文件

在server端生成一个密码文件/etc/rsyncd.pwd

引用
[root@linuxas3 root]# echo postfix:xxx >>/etc/rsyncd.pwd
[root@linuxas3 root]# echo netkiller:xxx >>/etc/rsyncd.pwd
[root@linuxas3 root]# chmod 600 /etc/rsyncd.pwd


启动rsync daemon

引用
[root@linuxas3 root]# rsync --daemon



测试

引用
[root@linux docbook]#  rsync rsync://www.9812.net/netkiller

[root@linux tmp]# rsync rsync://netkiller@www.9812.net/netkiller
Password:

[chen@linux temp]$  rsync -vzrtopg --progress --delete postfix@www.9812.net::postfix /tmp
Password:


rsync rsync://认证用户@主机/模块

rsync -vzrtopg --progress --delete 认证用户@主机::模块 /mirror目录

添加到启动文件

引用
echo "rsync --daemon" >> /etc/rc.d/rc.local



更复杂的使用,请参考http://rsync.samba.org/

rsync examples

(http://www.fanqiang.com)

原文链接:http://www.huihoo.com/internet/postfix/pis/x1145.html

 相关文章
Linux下的各种备份方法汇总 2001-04-21 18:40:17
使用tar命令进行磁带备份的命令汇总 2001-04-21 19:58:03
Solaris数据备份命令 2001-05-01 15:44:07
文件系统的备份与恢复(ufsdump ufsrestore) 2001-05-01 15:52:07
Linux系统备份 2001-05-02 02:38:45
Oracle数据库的备份与恢复 2001-04-16 10:26:11
自动备份Oracle数据库 2001-04-16 15:58:14

★  感谢所有的作者为我们学习技术知识提供了一条捷径  ★
www.fanqiang.com