CentOS Again

I had configured a caching proxy server to cache downloaded packages. I was caching packages for Ubuntu and CentOS. I configured a similar server at work, which includes Debian servers.

For the past few weeks I had the feeling something wasn’t working quite right. One clue was sometimes the updates were snappy because of the caching. Other times I was certain the CentOS server was downloading the full package rather than the cached version and the updating was taking a long time. Another clue was the abnormal number of “misses” reported by the caching proxy server.

My final clue was trying to update CentOS servers at work. One of the servers repeatedly refused to refresh itself and update. All other systems had refreshed and updated without quarrel.

Some digging revealed the problem to be the over-engineered mirror system of the yum command. Seems a server can get stuck on wanting to fetch from a specific upstream mirror. Updating mirrors takes time, probably 12 to 24 hours or so. When the package updates have not yet populated a specific mirror the local CentOS server replies that there are no updates.

To add to the fun, the local caching proxy servers were doing their job, but because each CentOS system tends to use a different mirror, the caching proxy was caching the same packages but under different mirror directories. That turned out to be a lot of duplication because those packages were not being cached.

The trick is not to use this over-engineered mirror method of updating. Instead configure a specific mirror and be done. That is, in each respective /etc/yum.repos.d config file, comment out the mirror= directive and use the baseurl= directive. Just hard-code the desired mirror.

When configured the same in this manner, from that point forward all local CentOS servers will only use that mirror and all package requests through the caching proxy server will be the same with no duplication.

In short, the algorithm used to find an upstream mirror kind of sucks. Sucks despite having already disabled the fastest mirror plugin too.

Posted: Category: Usability Tagged: CentOS

Next: Locking Guest Accounts

Previous: Getting Things Done