Install the MaxMind module
Log into your account at the MaxMind website and download the GeoIP databases. Copy them to your HAProxy Enterprise server (e.g.
/etc/hapee-2.0/GeoIP2-City.mmdb
,/etc/hapee-2.0/GeoIP2-ISP.mmdb
).-
Install the MaxMind module according to your platform:
$ # On Debian/Ubuntu $ sudo apt-get install hapee-2.0r1-lb-maxmind
$ # On CentOS/RedHat/Oracle $ sudo yum install hapee-2.0r1-lb-maxmind
$ # On SUSE $ sudo zypper install hapee-2.0r1-lb-maxmind
$ # On FreeBSD $ sudo pkg install hapee-2.0r1-lb-maxmind
-
In the
global
section of your configuration, add the following lines:global module-load hapee-lb-maxmind.so maxmind-load mlock_max 512000000 CITY
/etc/hapee-2.0/GeoIP2-City.mmdbISP/etc/hapee-2.0/GeoIP2-ISP.mmdbmaxmind-cache-size 200000 Reload the HAProxy Enterprise configuration to apply the changes.
Discover properties
Install the mmdblookup utility. This utility enables you to perform look ups for IP addresses in a MaxMind database file and learn the structure of the data.
-
Look up an IP address. For this exercise, the IP value can be any routable address:
$ mmdblookup --file /etc/hapee-2.0/GeoLite2-City.mmdb --ip 40.121.152.233
This returns a JSON document, as shown below. Use the document's structure to find a property to use with the
maxmind-lookup
converter. For example, to have HAProxy Enterprise look up the English language city name for a client's IP address, use the keys city, names, and en as represented in the JSON returned frommmdblookup
:{ "city": { "geoname_id": 4792307 <uint32> "names": { "en": "Washington" <utf8_string> } } // data continues... }
Next up
Configure the MaxMind module