|
不知道这里有没有,转过来再说
发信人: MrWrong (雨中的猪头), 信区: LinuxApp
标 题: gentoo rsync&source mirror how-to
发信站: 水木社区 (Wed Aug 17 21:04:11 2005), 站内
很早的东西 有点点参考价值
发信人: kangkang (康康), 信区: Linux
标 题: gentoo rsync&source mirror how-to
发信站: BBS 敬业湖畔 (2004-05-15,18:47:37 星期六), 站内
gentoo这两个mirror的原理大概如下
上级server rsync-server source-mirror-server
| rsync | rsync
本级server rsyncd(gentoo-portage) ftpd(gentoo)
| rsync | ftp
用户 SYNC="rsync://*/gentoo-portage" GENTOO_MIRRORS="ftp://*/gentoo"
rsync server:
1.同步上级服务器.
官方要求是每30min同步一次,这里是官方给出的一个脚本:
---------------------------------------------------------------------
rsync-gentoo-portage.sh
-----------------------
#!/bin/bash
RSYNC="/usr/bin/rsync"
OPTS="--quiet --recursive --links --perms --times --devices --delete --timeout=3
00"
#Uncomment the following line only if you have been granted access to rsync1.us.
gentoo.org
#SRC="rsync://rsync1.us.gentoo.org/gentoo-portage"
#If you are waiting for access to our master mirror, select one of our mirrors t
o mirror from:
SRC="rsync://rsync2.de.gentoo.org/gentoo-portage"
DST="/space/gentoo/rsync/"
echo "Started update at" `date` >> $0.log 2>&1
logger -t rsync "re-rsyncing the gentoo-portage tree"
${RSYNC} ${OPTS} ${SRC} ${DST} >> $0.log 2>&1
echo "End: "`date` >> $0.log 2>&1
---------------------------------------------------------------------------
测试阶段我们用的:
--------------------------------------------------------------------------
rsync.sh
------------
rsync -av --delete --force --ignore-errors rsync2.us.gentoo.org::gentoo-portage
/var/ftp/mirror/rsync/
--------------------------------------------------------------------------
这部分东西不多,截至到现在只有346M,从官方的列表中测试出来一个稍微快点的,
如果使用的是gentoo可以用netselect rsync.gentoo.org,更改上面的地址,也可以
用教育网的几个: ftp.tsinghua.edu.cn::gentoo-portage 两天同步一次
eelinux.3322.org::gentoo-portage 每天凌晨跟下面一个同步
radio.lzusiyu.org::gentoo-portage 每30min跟官方同步
注意一下,所选目录下的内容会被全部删除!所以请选择一个空目录。
可以把这个脚本加到crontab中定时更新。
2.设置与启动本级rsyncd.
先给出官方的配置文件:
-------------------------------------------------------------------------
rsyncd.conf
------------
uid = nobody
gid = nobody
use chroot = yes //出于安全性的考虑
max connections = 15 //最大连结数
pid file = /var/run/rsyncd.pid
motd file = /etc/rsync/rsyncd.motd //消息文件
log file = /var/log/rsync.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[gentoo-x86-portage]
#this entry is for compatibility
path = /space/gentoo/rsync //本地gentoo-portage目录
comment = Gentoo Linux Portage tree //描述
[gentoo-portage]
#modern versions of portage use this entry
path = /gentoo/rsync //这个跟上面的目录一样
comment = Gentoo Linux Portage tree mirror
exclude = distfiles
-----------------------------------------------------------------------
我们用的配置文件:
----------------------------------------------------------------------
/etc/rsyncd.conf
----------------
uid = nobody
gid = nobody
use chroot = yes
max connections = 20
pid file = /var/run/rsyncd.pid
motd file = /etc/rsync/rsyncd.motd
log file = /var/log/rsync.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[gentoo-x86-portage]
#this entry is for compatibility
path = /var/ftp/mirror/rsync
comment = Gentoo Linux Portage tree
[gentoo-portage]
#modern versions of portage use this entry
path = /var/ftp/mirror/rsync
comment = Gentoo Linux Portage tree mirror
exclude = distfiles
[gentoo]
path = /var/ftp/mirror/gentoo
comment = Gentoo Linux Source mirror
-----------------------------------------------------------------------
最后一段是为了下级同步的设置。
然后可以写一下rsyncd.motd,这个将在别人连接时显示。接着启动服务,先给出官方
的脚本:
------------------------------------------------------------------------------
/etc/init.d/rsyncd
------------------
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2
or later
# $Header: /var/www/www.gentoo.org/raw_cvs/gentoo/xml/htdocs/doc/en/rsync.xml,v
1.26 2004/05/03 12:30:06 neysx Exp $
depend() {
need net
}
# FYI: --sparce seems to cause problems.
RSYNCOPTS="--daemon --safe-links --timeout=300"
start() {
ebegin "Starting rsync daemon"
start-stop-daemon --start --quiet --pidfile /var/run/rsyncd.pid --nicelevel 15 -
-exec /usr/bin/rsync -- ${RSYNCOPTS}
eend $?
}
stop() {
ebegin "Stopping rsync daemon"
start-stop-daemon --stop --quiet --pidfile /var/run/rsyncd.pid
eend $?
}
-------------------------------------------------------------------------
我们的直接放在rc.local中了:
------------------------------------------------------------------------
/etc/rc.local
--------------
/usr/bin/rsync --daemon --timeout=300
------------------------------------------------------------------------
现在可以用 rsync --daemon 启动rsyncd服务
3.测试服务运行情况.
rsync rsync://yourserver/
# rsync rsync://radio.lzusiyu.org
===============================================
Welcome to Siyu(LZU) BBS Gentoo mirror
If you have some question,or report bug
please mailt [email protected]
===============================================
gentoo-x86-portage Gentoo Linux Portage tree
gentoo-portage Gentoo Linux Portage tree mirror
gentoo Gentoo Linux Source mirror
能看到rsyncd.motd的内容和所有开放的目录,可以用
rsync rsync://yourserver/gentoo-portage/
看一下里面的内容是否正常。
这样rsync的mirror就完成了。
source mirror server:
1.同步上级服务器.
官方要求4hr同步一次.截至现在共49G.
方法和上面一样,只是更改一下目录,我们的脚本:
--------------------------------------------------------------------------
source.sh
---------
rsync -av --delete --force --ignore-errors ftp.belnet.be::gentoo /var/ftp/mirror
/gentoo/
--------------------------------------------------------------------------
建议第一次跟教育网内的同步,同样注意,所选目录下的内容会被全部删除!
2.服务器设置.
任意一个ftpd即可.
PS:我们的crontab:
# crontab -l
5,35 * * * * /home/kangkang/gentoo/rsync.sh
20 1-22/4 * * * /home/kangkang/gentoo/source.sh
50 10,22 * * * /usr/sbin/ntpdate s1a.time.edu.cn
写的比较仓促,如果有问题欢迎反映。
--
※ 来源:·BBS 敬业湖畔 bbs.jingye.net·[FROM: 202.113.9.181]
----------------------------------------------
面朝大海
春暖花开
--
Welcome to lzusiyu.org, Welcome to LZU@smth.~
--
[15B
[36m※ 修改:·qie 于 Oct 8 08:48:38 修改本文·[FROM: 210.26.25.*][m
[m[1;36m※ 来源:·BBS_兰大思雨站 lzusiyu.org·[FROM: 210.26.25.*][m |
|