|
配置 rsync <br>
<br>
系统环境 <br>
<br>
[root@linuxas3 root]# uname -a <br>
Linux linuxas3.9812.net 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux <br><br>
<br>
安装rsync <br>
<br>
在AS3 第二张CD上找到rsync-2.5.6-20.i386.rpm <br>
<br>
[root@linuxas3 root]# cd /mnt <br>
[root@linuxas3 mnt]# mount cdrom <br>
[root@linuxas3 mnt]# cd cdrom/RedHat/RPMS <br>
[root@linuxas3 RPMS]# rpm -ivh rsync-2.5.6-20.i386.rpm <br><br>
<br>
配置/etc/rsyncd.conf <br>
<br>
在rh9,as3系统上rsync安装后,并没有创建rsyncd.conf文档,笔者是自己创建的rsyncd.conf文档 <br>
<br>
[root@linuxas3 root]# vi /etc/rsyncd.conf <br>
<br>
uid=nobody <br>
gid=nobody <br>
max connections=4 <br>
use chroot=no <br>
log file=/var/log/rsyncd.log <br>
pid file=/var/run/rsyncd.pid <br>
lock file=/var/run/rsyncd.lock <br>
#auth users=root <br>
secrets file=/etc/rsyncd.pwd <br>
<br>
[postfix] <br>
path=/var/mail <br>
comment = backup mail <br>
ignore errors <br>
read only = yes <br>
list = no <br>
auth users = postfix <br>
<br>
[netkiller] <br>
path=/home/netkiller/web <br>
comment = backup 9812.net <br>
ignore errors <br>
read only = yes <br>
list = no <br>
auth users = netkiller <br>
<br>
[pgsqldb] <br>
path=/var/lib/pgsql <br>
comment = backup postgresql database <br>
ignore errors <br>
read only = yes <br>
list = no <br>
<br><br>
<br>
选择说明 <br>
<br>
uid = nobody <br>
gid = nobody <br>
use chroot = no # 不使用chroot <br>
max connections = 4 # 最大连接数为4 <br>
pid file = /var/run/rsyncd.pid #进程ID文件 <br>
lock file = /var/run/rsync.lock <br>
log file = /var/log/rsyncd.log # 日志记录文件 <br>
secrets file = /etc/rsyncd.pwd # 认证文件名,主要保存用户密码,权限建议设为600,所有者root <br>
<br>
[module] # 这里是认证的模块名,在client端需要指定 <br>
path = /var/mail # 需要做镜像的目录 <br>
comment = backup xxxx # 注释 <br>
ignore errors # 可以忽略一些无关的IO错误 <br>
read only = yes # 只读 <br>
list = no # 不允许列文件 <br>
auth users = postfix # 认证的用户名,如果没有这行,则表明是匿名 <br>
<br>
[other] <br>
path = /path/to... <br>
comment = xxxxx <br><br>
<br>
密码文件 <br>
<br>
在server端生成一个密码文件/etc/rsyncd.pwd <br>
<br>
[root@linuxas3 root]# echo postfix:xxx >>/etc/rsyncd.pwd <br>
[root@linuxas3 root]# echo netkiller:xxx >>/etc/rsyncd.pwd <br>
[root@linuxas3 root]# chmod 600 /etc/rsyncd.pwd <br><br>
<br>
启动rsync daemon <br>
<br>
[root@linuxas3 root]# rsync --daemon <br><br>
<br>
测试 <br>
<br>
[root@linux docbook]# rsync rsync://www.9812.net/netkiller <br>
<br>
[root@linux tmp]# rsync rsync://netkiller@www.9812.net/netkiller <br>
Password: <br>
<br>
[chen@linux temp]$ rsync -vzrtopg --progress --delete postfix@www.9812.net::postfix /tmp <br>
Password: <br><br>
<br>
rsync rsync://认证用户@主机/模块 <br>
<br>
rsync -vzrtopg --progress --delete 认证用户@主机::模块 /mirror目录 <br>
<br>
添加到启动文件 <br>
<br>
echo "rsync --daemon" >> /etc/rc.d/rc.local<br>
<br>
<br>
|
|