«
»

Maxmind’s GeoIP.dat.gz location change

November 27th, 2008 by George Notaras

Today I noticed that AWStats, the web traffic analysis tool, had stopped generating valid reports since November 23. After spending about 3 whole hours trying to figure out what on earth had happened and having checked all the things that could have gone wrong, I went through all the automatic emails my server had sent me during the last 4 days and, finally, found out that a cronjob, which updates the GeoIP database on a weekly basis, instead of saving the actual database, it had saved the HTML error document, because the actual database could not be found at its normal location on the web. Maxmind, the company that publishes the database had just moved it to a new location without even bothering to create a symlink! AWStats on the other hand did not print any relevant error message. It just behaved strangely. As soon as I fixed the URL to GeoIP.dat.gz inside the cronjob and updated the files, all things came back to normal.

Update: Talking about URLs without actually writing them is a bit awkward, so here is the ugly script I use to update the free GeoIP databases from Maxmind:

#! /bin/sh

LIMIT="100k"

# Update GeoLite Country (GeoIP default)
wget --limit-rate=$LIMIT http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/share/GeoIP/GeoIP.dat.gz
rm -f /usr/share/GeoIP/GeoIP.dat
gunzip /usr/share/GeoIP/GeoIP.dat.gz

# Update GeoLite City
wget --limit-rate=$LIMIT http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /usr/share/GeoIP/GeoLiteCity.dat.gz
rm -f /usr/share/GeoIP/GeoLiteCity.dat
gunzip /usr/share/GeoIP/GeoLiteCity.dat.gz

It shows the current URLs for the free or lite versions of GeoLite Country (GeoIP.dat) and GeoLiteCity databases. Currently, I have enabled the first one in AWStats.

Note to self. I should urgently add some checks prior to replacing the current databases. This goes in the TODO list.

The Maxmind’s GeoIP.dat.gz location change by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Terms and conditions beyond the scope of this license may be available at www.g-loaded.eu.

Related Articles

Tags: ,

Bookmark and Share

3 Responses to “Maxmind’s GeoIP.dat.gz location change”

  1. BOK Says :

    It would be appreciated if you could give your readers the correct URL to the new GeoIP.dat.gz! ;-)

  2. joost Says :

    i think this is the new one:
    http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/

  3. George Notaras Says :

    @BOK: You are right. I added the script, which shows the URLs
    @joost: Exactly

    Thanks for the feedback

Comments are automatically disabled after a certain period of time. Further discussion about the published content is still possible though in the G-Loaded Forums.