[CentOS] Why not use yum mirrorlist= instead of baseurl= in CentOS-Base.repo

Adam Gibson agibson at ptm.com
Thu Oct 13 20:30:25 UTC 2005

Currently the default yum configuration references mirror.centos.org. 
When yum looks up the IP address it finds several but it will only try 
one and fail if that server is down or does not have the headers for 
whatever reason.

If yum were to reference a mirrorlist it would skip servers that fail 
and keep trying them all until it finds one that works or exhausts all 
the mirrors.  Centos would host a file on their web server for each 
repository that has a list of mirror baseurls.

I created a test script to generate mirrorlists from the 
mirror.centos.org DNS lookup and changed yum to reference the local 
files that were generated as a mirrorlist= and it worked.  The 
non-synced servers that did not have the correct directories setup were 
skipped and it found servers that did work.

Are there any plans to provide a centos-yumconf rpm that links to a 
mirrorlist on centos.org instead of just using the DNS round-robin of 
mirror.centos.org which will cause yum to fail if it happens to get an 
IP that does not work?  Centos would just need to change the mirrorlist 
file on the main website to change mirrors for clients.  Each mirror 
would need to have a DNS entry of its own but it would make things work 
better for updates when 1 server is not synced properly or has some 
other problem(down, etc).

---- begin gen-centos-mirrorlist.sh script ----
host mirror.centos.org | grep " has address " | cut -f 4 -d " " | \
   sed "s#.*#http://\0/centos/4/updates/i386/#" > \
host mirror.centos.org | grep " has address " | cut -f 4 -d " " | \
   sed "s#.*#http://\0/centos/4/os/i386/#" > /etc/centos-mirror-base.list
host mirror.centos.org | grep " has address " | cut -f 4 -d " " | \
   sed "s#.*#http://\0/centos/4/addons/i386/#" > \
host mirror.centos.org | grep " has address " | cut -f 4 -d " " | \
   sed "s#.*#http://\0/centos/4/extras/i386/#" > \
host mirror.centos.org | grep " has address " | cut -f 4 -d " " | \
   sed "s#.*#http://\0/centos/4/centosplus/i386/#" > \
---- end generation script ----

---- begin changed CentOS-Base.repo yum configuration ----
name=CentOS-$releasever - Base

#released updates
name=CentOS-$releasever - Updates

#packages used/produced in the build but not released
name=CentOS-$releasever - Addons

#additional packages that may be useful
name=CentOS-$releasever - Extras

#additional packages that extend functionality of existing packages
name=CentOS-$releasever - Plus

NOTE: My hack with using IPs from mirror.centos.org has the flaw in that 
the http servers in the list files are referenced by IP.  If the mirror 
http server is using a Name Virtual Host and centos is not the default 
web site for that IP then it might try pulling the files from the wrong 
configured virtual host on that mirror.  This might make some mirrors 
not work.

More information about the CentOS mailing list